public void UpdateItems(LaptopSpecification item) { LaptopSpecification specification = GetLaptopById(item.Id); specification.Id = item.Id; specification.Brand = item.Brand; specification.Price = item.Price; specification.Description = item.Description; }
public void DeleteItem(int id) { LaptopSpecification item = GetLaptopById(id); if (item != null) { products.Remove(item); } }
public ActionResult Update(LaptopSpecification specification) { laptop.UpdateItems(specification); TempData["Message"] = "Item Updated Successfully!"; return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { LaptopSpecification specification = laptop.GetLaptopById(id); return(View(specification)); }
public ActionResult Create(LaptopSpecification product) { laptop.AddLaptop(product); TempData["Message"] = "Item added successfully"; return(RedirectToAction("Index")); }
public void AddLaptop(LaptopSpecification product) { products.Add(product); }