public async Task <ResponseResult <int> > Post(RoleDto dto) { var item = await _roleService.AddOrUpdate <RoleDto, int>(dto); var result = new ResponseResult <int>(item.Id); return(result); }
public ActionResult Create(RoleModel model) { if (_roleService.ExisSystemName(model.SystemName, model.Id)) { WarringNotification("系统名称已存在!"); return(View(model)); } if (_roleService.ExistName(model.Name, model.Id)) { WarringNotification("角色名称已存在!"); return(View(model)); } if (_roleService.AddOrUpdate(model) > 0) { SuccessNotification("保存成功!"); return(RedirectToAction("RoleList")); } return(View(model)); }