Esempio n. 1
0
 // GET: Cars/Details/5
 public ActionResult Details(int id)
 {
     try
     {
         var dto = _getCarCommand.Execute(id);
         return(View(dto));
     }
     catch (EntityNotFoundException ex)
     {
         TempData["error"] = ex.Message;
     }
     catch (Exception e)
     {
         TempData["greska"] = "Doslo je do greske.";
     }
     return(View());
 }
Esempio n. 2
0
 public ActionResult <CarShowDto> Get(int id)
 {
     try
     {
         return(Ok(_getCar.Execute(id)));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(StatusCode(500));
     }
 }
 public IActionResult Get(
     [FromServices] IGetCarCommand command,
     int id) => command.Execute(id);