public ActionResult <TableModel> GetTable(int tableId)
 {
     try
     {
         return(_tableService.GetTable(tableId));
     }
     catch (NotFoundOperationException ex)
     {
         return(NotFound(ex.Message));;
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, $"Something happend: {ex.Message}"));
     }
 }
Beispiel #2
0
 public IActionResult GetTableById(string id)
 {
     try
     {
         Table t = _tablesService.GetTable(id);
         if (t == null)
         {
             return(NotFound("Table with id not found"));
         }
         return(Ok(_mapper.Map <TableDto>(t)));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
     }
 }