public IActionResult Post([FromBody] User user)
 {
     try
     {
         User userCreated = userManagement.Create(user);
         return(CreatedAtRoute("user", new { id = user.Id }, UserModelForResponse.ToModel(userCreated)));
     }
     catch (DomainBusinessLogicException e)
     {
         return(BadRequest(e.Message));
     }
     catch (ServerBusinessLogicException e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
 public IActionResult Get()
 {
     try
     {
         IEnumerable <User> allUsers = userManagement.GetAll();
         return(Ok(UserModelForResponse.ToModel(allUsers)));
     }
     catch (ClientBusinessLogicException e)
     {
         return(NotFound(e.Message));
     }
     catch (ServerBusinessLogicException e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
 public IActionResult Get(Guid id)
 {
     try
     {
         User user = userManagement.GetUser(id);
         UserModelForResponse toReturn = UserModelForResponse.ToModel(user);
         return(Ok(toReturn));
     }
     catch (ClientBusinessLogicException e)
     {
         return(NotFound(e.Message));
     }
     catch (ServerBusinessLogicException e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
 public IActionResult Put(Guid id, [FromBody] User user)
 {
     try
     {
         User userUpdated = userManagement.UpdateUser(id, user);
         return(CreatedAtRoute("user", new { id = userUpdated.Id }, UserModelForResponse.ToModel(userUpdated)));
     }
     catch (DomainBusinessLogicException e)
     {
         return(BadRequest(e.Message));
     }
     catch (ClientBusinessLogicException e)
     {
         return(NotFound(e.Message));
     }
     catch (ServerBusinessLogicException e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }