示例#1
0
 public HttpResponseMessage Create(RoleModel model)
 {
     if (_roleService.CreateRole(new Role
     {
         RoleName = model.RoleName,
         Status = RoleStatus.Normal,
         Description = model.Description
     }) != null)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功!"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败!"));
 }
示例#2
0
 public HttpResponseMessage Edit(RoleModel model)
 {
     var role = _roleService.GetRoleById(model.Id);
     role.RoleName = model.RoleName;
     role.Description = model.Description;
     role.Status = model.Status;
     if (_roleService.ModifyRole(role))
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据更新成功!"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据更新失败!"));
 }