示例#1
0
 // GET: Topics/Details/5
 public ActionResult Details(int id)
 {
     try
     {
         var dto = _getOneCommand.Execute(id);
         return(View(dto));
     }
     catch (EntityNotFoundException)
     {
         TempData["error"] = "This Topic doesnt exist";
         return(View());
     }
     catch (Exception)
     {
         return(View());
     }
 }
 public IActionResult Get(int id)
 {
     try
     {
         var topic = _getOneCommand.Execute(id);
         return(Ok(topic));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500, "An Error has occured."));
     }
 }