Пример #1
0
        public OperationResult Insert(ModuleModel model)
        {
            var entity = new Module
            {
                Name       = model.Name,
                Code       = model.Code,
                ParentId   = model.ParentId != 0 ? model.ParentId : null,
                LinkUrl    = model.LinkUrl,
                Area       = model.Area,
                Controller = model.Controller,
                Action     = model.Action,
                OrderSort  = model.OrderSort,
                Icon       = model.Icon != null ? model.Icon : "",
                Enabled    = model.Enabled,
                CreateId   = model.CreateId,
                CreateBy   = model.CreateBy,
                CreateTime = DateTime.Now,
                ModifyId   = model.ModifyId,
                ModifyBy   = model.ModifyBy,
                IsMenu     = model.IsMenu,
                ModifyTime = DateTime.Now
            };

            ModuleRepository.Insert(entity);
            return(new OperationResult(OperationResultType.Success, "添加成功"));
        }