public async Task <IActionResult> Add(Permissions Permissions) { bool res = false; Permissions.UpdateDate = DateTime.Now; if (Permissions.Id > 0) { res = await _permissionsServices.Update(Permissions); } else { var data = await _permissionsServices.QueryByClause(m => m.Code == Permissions.Code); if (data != null) { return(Error(Permissions.Code + "已经存在!")); } res = await _permissionsServices.Add(Permissions); } if (res) { return(Success("保存成功")); } else { return(Error("保存失败")); } }
public async Task <IActionResult> Post([FromBody] PermissionsDTO permDto) { var permiso = _mapper.Map <Permissions>(permDto); await _permissionsServices.Add(permiso); permDto = _mapper.Map <PermissionsDTO>(permiso); var response = new GenericResponse <PermissionsDTO>(permDto); return(Ok(response)); }
public int JurisAdd(Jurisdiction jurisdiction) { return(_permissionsServices.Add(jurisdiction)); }