增加JSON IGNORE設定

This commit is contained in:
2025-11-12 12:50:13 +08:00
parent c0404b8e70
commit 22d283dbe6
4 changed files with 44 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
/// <summary>
/// added
/// </summary>
namespace Model
{
[MetadataType(typeof(family_membersMetadata))]
public partial class family_members
{
private class family_membersMetadata
{
[JsonIgnore]
public virtual follower follower { get; set; }
}
}
}

View File

@@ -45,6 +45,19 @@ namespace Model
public virtual ICollection<followers_tablet> followers_tablet { get; set; }
[JsonIgnore]
public virtual appellation appellation { get; set; }
/// <summary>
/// added
/// </summary>
[JsonIgnore]
public virtual ICollection<family_members> family_members { get; set; }
[JsonIgnore]
public virtual ICollection<transfer_register> transfer_register { get; set; }
[JsonIgnore]
public virtual ICollection<transfer_register> transfer_register1 { get; set; }
[JsonIgnore]
public virtual ICollection<GuaDanOrder> GuaDanOrder { get; set; }
[JsonIgnore]
public virtual ICollection<GuaDanOrderGuest> GuaDanOrderGuest { get; set; }
}

View File

@@ -98,7 +98,17 @@ public class familyMembersController : ApiController
[Route("api/familymembers/follower/{followerId}")]
public IHttpActionResult GetByFollower(int followerId)
{
//var originalLazyLoading = _db.Configuration.LazyLoadingEnabled;
//var originalProxyCreation = _db.Configuration.ProxyCreationEnabled;
//
//_db.Configuration.LazyLoadingEnabled = false;
//_db.Configuration.ProxyCreationEnabled = false;
var familyMembers = _db.family_members.Where(fm => fm.follower_num == followerId).ToList();
//_db.Configuration.LazyLoadingEnabled = originalLazyLoading;
//_db.Configuration.ProxyCreationEnabled = originalProxyCreation;
return Ok(familyMembers);
}

View File

@@ -1393,7 +1393,7 @@
message: `確定要將 ${guest.follower.u_name || ''} 退房嗎?`,
onConfirm: async () => {
try {
const response = await axios.post(`/api/guadanorderguest/checkout`, null, {
const response = await axios.post(HTTP_HOST + `/api/guadanorderguest/checkout`, null, {
params: { uuid: guest.uuid }
});
@@ -1594,7 +1594,7 @@
onConfirm: async () => {
try {
// 發送請求到後端 API
const response = await axios.post(`/api/guadanorderguest/checkin`, null, {
const response = await axios.post(HTTP_HOST + `/api/guadanorderguest/checkin`, null, {
params: { uuid: guest.uuid }
});