// GET: Products/Details/5 public ActionResult Details(int id) { var product = _getProduct.Execute(id); if (product == null) { return(RedirectToAction("Index")); } return(View(product)); }
// GET: Products/Edit/5 public ActionResult Edit(int id) { try { var product = _getOne.Execute(id); return(View(product)); } catch (EntityNotFoundException e) { return(RedirectToAction("Index"));; } }
public IActionResult Get(int id) { try { var product = _getOneCommand.Execute(id); return(Ok(product)); } catch (EntityNotFoundException) { return(NotFound()); } catch (Exception) { return(StatusCode(500, "Doslo je do greske")); } }
public IActionResult Edit(long Id) { try { var product = _getProduct.Execute(Id); ViewBag.ProductInsertData = _getProductInsertData.Execute(); return(View(product)); } catch (EntityNotFoundException e) { TempData["Msg"] = e.Message; return(RedirectToAction("index")); } catch (Exception e) { TempData["Msg"] = e.Message; return(RedirectToAction("index")); } }