Пример #1
0
 // GET: Comments/Details/5
 public ActionResult Details(int id)
 {
     try
     {
         var comment = _getOneCommand.Execute(id);
         return(View(comment));
     }
     catch (Exception)
     {
         return(View());
     }
 }
Пример #2
0
 public IActionResult Get(int id)
 {
     try
     {
         return(Ok(getComment.Execute(id)));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
 }
Пример #3
0
        // GET: Comments/Details/5
        public ActionResult Details(int id)
        {
            try
            {
                return(View(_getOneCommentCommand.Execute(id)));
            }
            catch (EntityNotFoundException e)
            {
                TempData["error"] = e.Message;
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }

            return(RedirectToAction(nameof(Index)));
        }
Пример #4
0
 // GET: Comment/Details/5
 //[LoggedIn]
 public ActionResult Details(int id)
 {
     try
     {
         var dto = _getCommentCommand.Execute(id);
         return(View(dto));
     }
     catch (EntityNotFoundException ex)
     {
         TempData["error"] = ex.Message;
     }
     catch (Exception e)
     {
         TempData["greska"] = "Doslo je do greske.";
     }
     return(View());
 }
Пример #5
0
 public IActionResult Get(int id)
 {
     try
     {
         var commentDto = _getOneCommand.Execute(id);
         return(Ok(commentDto));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Пример #6
0
 public ActionResult <CommentDto> Get(int id)
 {
     try
     {
         var dto = _getCommentCommand.Execute(id);
         return(Ok(dto));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
 public ActionResult <IEnumerable <CommentDTO> > Get(int id)
 {
     try
     {
         var commentDTO = _getCommentCommand.Execute(id);
         return(Ok(commentDTO));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Пример #8
0
 public ActionResult <CommentDto> Get(int id)
 {
     try
     {
         return(Ok(_getOneCommentCommand.Execute(id)));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
Пример #9
0
 public ActionResult Get(int id)
 {
     try
     {
         return(Ok(getCommentCommand.Execute(id)));
     }
     catch (DataNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Пример #10
0
 public IActionResult Get(int id)
 {
     try
     {
         var comment = _getOneCommand.Execute(id);
         return(Ok(comment));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500, "An Error Occured"));
     }
 }
 public ActionResult <CreateCommentDto> Get(int id)
 {
     try
     {
         var comment = _getOne.Execute(id);
         return(Ok(comment));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Пример #12
0
 public ActionResult Get(int id)
 {
     try
     {
         var one = _getOneCommand.Execute(id);
         return(Ok(one));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server error has occurred."));
     }
 }
Пример #13
0
        public ActionResult Edit(int id)
        {
            var response = _getCommentCommand.Execute(id);

            return(View(response));
        }
Пример #14
0
        // GET: Comment/Details/5
        //[LoggedIn]
        public ActionResult Details(int id)
        {
            var dto = _getCommentCommand.Execute(id);

            return(View(dto));
        }