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("新增失败")); } }
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)); } }
public ResponseResult Add(SysRole Role) { return(SysRoleService.Add(Role)); }
public ActionResult Assign(int id, List <DtreeResponse> dtrees) { SysRoleService.Add(id, dtrees); return(WriteSuccess("保存成功")); }