public IActionResult Post([FromBody] Permission permission) { if (permission == null) { return(BadRequest()); } return(new ObjectResult(_permissionBusiness.Create(permission))); }
public async Task <IActionResult> PostPermission(PermissionDTO permissionDTO) { try { var permission = _mapper.Map <Permission>(permissionDTO); var resp = await _permissionBusiness.Create(permission); return(Ok(permission)); } catch (Exception e) { var permissionResponse = _mapper.Map <ResponsePermissionDTO>(permissionDTO); permissionResponse.Error = e.Message; return(Ok(permissionResponse)); } }