예제 #1
0
        public virtual IHttpActionResult Add(SysRoleAddRequest request)
        {
            var entity = new SysRole
            {
            };
            var result = _sysRoleService.Add(entity);

            if (result > 0)
            {
                return(Succeed(new SysRoleAddResponse
                {
                    Id = entity.Id
                }, "新增成功"));
            }
            else
            {
                return(Fail("新增失败"));
            }
        }
예제 #2
0
 public ActionResult Create(SysRoleViewModel viewModel)
 {
     try
     {
         if (ModelState.IsValid == false)
         {
             return(WriteError("实体验证失败"));
         }
         SysRole entity = viewModel.EntityMap();
         entity.CreateUserId = UserManager.GetCurrentUserInfo().Id;
         entity.UpdateUserId = UserManager.GetCurrentUserInfo().Id;
         entity.CreateTime   = DateTime.Now;
         entity.UpdateTime   = DateTime.Now;
         SysRoleService.Add(entity);
         return(WriteSuccess());
     }
     catch (Exception ex)
     {
         return(WriteError(ex));
     }
 }
예제 #3
0
 public ResponseResult Add(SysRole Role)
 {
     return(SysRoleService.Add(Role));
 }
예제 #4
0
 public ActionResult Assign(int id, List <DtreeResponse> dtrees)
 {
     SysRoleService.Add(id, dtrees);
     return(WriteSuccess("保存成功"));
 }