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()); }
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)); } }