public async Task <ObjectResultModule> UpdateYaeherModule([FromBody] Yaeher.YaeherAuth.Dto.YaeherModuleNode YaeherModuleInfo) { if (!Commons.CheckSecret(YaeherModuleInfo.Secret)) { this.ObjectResultModule.StatusCode = 422; this.ObjectResultModule.Message = "Wrong Secret"; this.ObjectResultModule.Object = ""; return(this.ObjectResultModule); } var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0; var UpdateYaeherModule = await _yaeherModuleService.YaeherModuleByID(YaeherModuleInfo.Id); if (UpdateYaeherModule != null) { UpdateYaeherModule.ParentId = YaeherModuleInfo.ParentId; UpdateYaeherModule.Names = YaeherModuleInfo.Names; UpdateYaeherModule.LinkUrls = YaeherModuleInfo.LinkUrls; UpdateYaeherModule.Areas = YaeherModuleInfo.Areas; UpdateYaeherModule.Controllers = YaeherModuleInfo.Controllers; UpdateYaeherModule.Actionss = YaeherModuleInfo.Actionss; UpdateYaeherModule.Icons = YaeherModuleInfo.Icons; UpdateYaeherModule.Codes = YaeherModuleInfo.Codes; UpdateYaeherModule.OrderSort = YaeherModuleInfo.OrderSort; UpdateYaeherModule.Description = YaeherModuleInfo.Description; UpdateYaeherModule.IsMenu = YaeherModuleInfo.IsMenu; UpdateYaeherModule.Enabled = YaeherModuleInfo.Enabled; UpdateYaeherModule.ModifyOn = DateTime.Now; UpdateYaeherModule.ModifyBy = userid; var result = await _yaeherModuleService.UpdateYaeherModule(UpdateYaeherModule); this.ObjectResultModule.Object = result; this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Message = "success"; } else { this.ObjectResultModule.Object = ""; this.ObjectResultModule.StatusCode = 404; this.ObjectResultModule.Message = "NotFound"; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "UpdateYaeherModule", OperContent = JsonHelper.ToJson(YaeherModuleInfo), OperType = "UpdateYaeherModule", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(ObjectResultModule); }
public async Task <ObjectResultModule> DeleteYaeherModule([FromBody] Yaeher.YaeherAuth.Dto.YaeherModuleNode YaeherModuleInfo) { if (!Commons.CheckSecret(YaeherModuleInfo.Secret)) { this.ObjectResultModule.StatusCode = 422; this.ObjectResultModule.Message = "Wrong Secret"; this.ObjectResultModule.Object = ""; return(this.ObjectResultModule); } var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0; var query = await _yaeherModuleService.YaeherModuleByID(YaeherModuleInfo.Id); if (query != null) { query.DeleteBy = userid; query.DeleteTime = DateTime.Now; query.IsDelete = true; var res = await _yaeherModuleService.DeleteYaeherModule(query); this.ObjectResultModule.Object = res; this.ObjectResultModule.Message = "sucess"; this.ObjectResultModule.StatusCode = 200; } else { this.ObjectResultModule.Message = "NotFound"; this.ObjectResultModule.StatusCode = 404; this.ObjectResultModule.Object = ""; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "DeleteYaeherModule", OperContent = JsonHelper.ToJson(YaeherModuleInfo), OperType = "DeleteYaeherModule", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(this.ObjectResultModule); }
public async Task <ObjectResultModule> CreateYaeherModule([FromBody] Yaeher.YaeherAuth.Dto.YaeherModuleNode YaeherModuleInfo) { if (!Commons.CheckSecret(YaeherModuleInfo.Secret)) { this.ObjectResultModule.StatusCode = 422; this.ObjectResultModule.Message = "Wrong Secret"; this.ObjectResultModule.Object = ""; return(this.ObjectResultModule); } var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0; YaeherModuleIn yaeherModuleIn = new YaeherModuleIn(); yaeherModuleIn.AndAlso(a => a.IsDelete == false); yaeherModuleIn.AndAlso(a => a.LinkUrls == YaeherModuleInfo.LinkUrls); yaeherModuleIn.AndAlso(a => a.Names == YaeherModuleInfo.Names); yaeherModuleIn.AndAlso(a => a.Codes == YaeherModuleInfo.Codes); yaeherModuleIn.AndAlso(a => a.ParentId == YaeherModuleInfo.ParentId); yaeherModuleIn.AndAlso(a => a.Areas == YaeherModuleInfo.Areas); yaeherModuleIn.AndAlso(a => a.Controllers == YaeherModuleInfo.Controllers); yaeherModuleIn.AndAlso(a => a.IsMenu == YaeherModuleInfo.IsMenu); var ModuleList = await _yaeherModuleService.YaeherModule(yaeherModuleIn); if (ModuleList.Count() > 0) { this.ObjectResultModule.Object = ""; this.ObjectResultModule.StatusCode = 100; this.ObjectResultModule.Message = "菜单已存在不可新增!"; return(ObjectResultModule); } var CreateYaeherModule = new YaeherModule() { ParentId = YaeherModuleInfo.ParentId, Names = YaeherModuleInfo.Names, LinkUrls = YaeherModuleInfo.LinkUrls, Areas = YaeherModuleInfo.Areas, Controllers = YaeherModuleInfo.Controllers, Actionss = YaeherModuleInfo.Actionss, Icons = YaeherModuleInfo.Icons, Codes = YaeherModuleInfo.Codes, OrderSort = YaeherModuleInfo.OrderSort, Description = YaeherModuleInfo.Description, IsMenu = YaeherModuleInfo.IsMenu, Enabled = YaeherModuleInfo.Enabled, CreatedBy = userid, CreatedOn = DateTime.Now }; var result = await _yaeherModuleService.CreateYaeherModule(CreateYaeherModule); if (result.Id > 0) { this.ObjectResultModule.Object = result; this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Message = "success"; } else { this.ObjectResultModule.Object = ""; this.ObjectResultModule.StatusCode = 400; this.ObjectResultModule.Message = "error!"; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "CreateYaeherModule", OperContent = JsonHelper.ToJson(YaeherModuleInfo), OperType = "CreateYaeherModule", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(ObjectResultModule); }