using APT.Infrastructure.Core; using APT.MS.Domain.Entities.SK; using APT.Utility; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; namespace APT.SK.WebApi.Controllers.Api { [Route("api/SK/SKBasicLibraryTemp")] public partial class BasicLibraryTempController : AuthorizeApiController { /// /// 保存 /// /// /// [HttpPost, Route("FullUpdate")] public JsonActionResult FullUpdate([FromBody] T_SK_BASIC_LIBRARY_TEMP entity) { return SafeExecute(() => { var measures = entity.Nav_Measures; entity.Nav_Measures = null; var contents = entity.Nav_Contents; entity.Nav_Contents = null; var hiddens = entity.Nav_Hiddens; entity.Nav_Hiddens = null; List levelList = new List(); if (measures != null && measures.Any()) { foreach (var item in measures) { if (item.Nav_Levels != null && item.Nav_Levels.Any()) { foreach (var item2 in item.Nav_Levels) { item2.ORG_ID = entity.ORG_ID; item2.BASIC_LIBRARY_TEMP_MEASURE_ID = item.ID; item2.Nav_Measure = null; levelList.Add(item2); } } item.ORG_ID = entity.ORG_ID; item.BASIC_LIBRARY_TEMP_ID = entity.ID; item.Nav_Levels = null; } } if (contents != null && contents.Any()) { foreach (var item in contents) { item.ORG_ID = entity.ORG_ID; item.BASIC_LIBRARY_TEMP_ID = entity.ID; item.Nav_Contents = null; } } if (hiddens != null && hiddens.Any()) { foreach (var item in hiddens) { item.ORG_ID = entity.ORG_ID; item.BASIC_LIBRARY_TEMP_ID = entity.ID; } } this.UnifiedCommit(() => { if (entity != null) UpdateEntityNoCommit(entity); if (measures != null && measures.Any()) BantchSaveEntityNoCommit(measures); if (levelList != null && levelList.Any()) BantchSaveEntityNoCommit(levelList); if (contents != null && contents.Any()) BantchSaveEntityNoCommit(contents); if (hiddens != null && hiddens.Any()) BantchSaveEntityNoCommit(hiddens); }); return true; }); } } }