Exemple #1
0
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteHashtagCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }
Exemple #2
0
        public ActionResult Delete(int id)
        {
            try
            {
                _deleteHashtagCommand.Execute(id);
                TempData["success"] = "Hashtag deleted.";
            }
            catch (EntityNotFoundException e)
            {
                TempData["error"] = e.Message;
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }

            return(RedirectToAction(nameof(Index)));
        }