public async Task <ActionResult <RoleViewModel> > AddRole(RoleViewModel roleViewModel) { try { var result = await _supervisor.AddRoleAsync(roleViewModel); if (!result.Result || result.Item == null) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error in create Role")); } return(CreatedAtRoute("GetRoleById", new { roleId = result.Item.id }, result.Item)); } catch (Exception ex) { _logger.LogError(ex, "Exception: "); return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }