public ActionResult DeleteExtProduct(ExtProductModel extProduct) { var session = new ExtProductSessionManager(HttpContext); session.DeleteExtProduct(extProduct); return(RedirectToAction(nameof(ExtProductList))); }
public List <ExtProductModel> AddExtProduct(ExtProductModel extProduct) { var extnProducts = GetOrCreateExtProductList(); extProduct.Id = extnProducts.Count > 0 ? extnProducts.Max(x => x.Id) + 1 : 1; extnProducts.Add(extProduct); return(extnProducts); }
public List <ExtProductModel> DeleteExtProduct(ExtProductModel extProduct) { var extProducts = GetOrCreateExtProductList(); var queryDelete = extProducts .Where(x => x.Id == extProduct.Id) .FirstOrDefault(); extProducts.Remove(queryDelete); return(extProducts); }
public ActionResult EditExtProduct(ExtProductModel extProduct) { if (ModelState.IsValid) { var session = new ExtProductSessionManager(HttpContext); session.EditExtProduct(extProduct); return(RedirectToAction(nameof(ExtProductList))); } return(View(extProduct)); }
public ExtProductModel EditExtProduct(ExtProductModel extProduct) { var editExtProduct = GetOrCreateExtProductList() .Where(x => x.Id == extProduct.Id) .FirstOrDefault(); editExtProduct.Name = extProduct.Name; editExtProduct.Quantity = extProduct.Quantity; editExtProduct.MassUnits = extProduct.MassUnits; return(editExtProduct); }