示例#1
0
 public IActionResult Post([FromBody] AddGameDto request)
 {
     try
     {
         createGame.Execute(request);
         return(StatusCode(201));
     }
     catch (AlreadyExistsEx ex)
     {
         return(StatusCode(409, ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
示例#2
0
 public IActionResult Post([FromBody] AddGameDto dto)
 {
     try
     {
         _addGame.Execute(dto);
         return(StatusCode(201));
     }
     catch (GameExistsException)
     {
         return(StatusCode(409, "Game already exists"));
     }
     catch (CompanyDoesntExistException)
     {
         return(StatusCode(404, "Company doesn't exist"));
     }
     catch (CategoryDoesntExistException)
     {
         return(StatusCode(404, "Category doesn's exist"));
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server error, try again later"));
     }
 }