Exemplo n.º 1
0
 // GET: News/Details/5
 public ActionResult Details(int id)
 {
     try
     {
         var dto = _getNewCommand.Execute(id);
         return(View(dto));
     }
     catch (EntityNotFoundException ex)
     {
         TempData["error"] = ex.Message;
     }
     catch (Exception e)
     {
         TempData["greska"] = "Doslo je do greske.";
     }
     return(View());
 }
Exemplo n.º 2
0
 public ActionResult <NewsDto> Get(int id)
 {
     try
     {
         var dto = _getNewCommand.Execute(id);
         return(Ok(dto));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }