Example #1
0
        public ActionResult Delete(int id, IFormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                _deleteProizvod.Execute(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (EntityNotFoundException e) { TempData["Error"] = e.Message; }
            catch (Exception e) { TempData["Error"] = "Server error " + e.Message; }
            return(View());
        }
Example #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         _deleteProizvod.Execute(id);
         return(StatusCode(200));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }