// It asks for a confirmation in deleting a selected product from the table public ActionResult Delete(int?idItem) { if (idItem != null) { try { ISoldProductModel product = soldProductData.FindById((int)idItem); if (product == null) { log.Error("Could't find a product in the Database - return null"); return(View("ErrorDeleteProduct")); } return(View(product)); } catch (Exception ex) { log.Error("Could't load product from Database", ex); return(View("ErrorRetriveData")); } } else { log.Error("The sold product ID was null while trying to access"); return(View("ErrorDeleteProduct")); } }
// GET: api/SoldProducts/5 public ISoldProductModel Get(int id) { if (soldProductData.GetAll().Exists(x => x.ID == id)) { return(soldProductData.FindById(id)); } else { return(null); } }