Ejemplo n.º 1
0
 public async Task <YaeherModule> DeleteYaeherModule(YaeherModule YaeherModulefo)
 {
     return(await _repository.UpdateAsync(YaeherModulefo));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public async Task <YaeherModule> CreateYaeherModule(YaeherModule YaeherModulefo)
        {
            YaeherModulefo.Id = await _repository.InsertAndGetIdAsync(YaeherModulefo);

            return(YaeherModulefo);
        }