public ActionResult Create(ProductModals modal) { int id = process.Save(modal); if (id > 0) { return(RedirectToAction("Index")); } return(PartialView()); }
public bool Edit(int id, ProductModals models) { using (var contest = new PrkStoreEntities()) { var employee = contest.tblProduct.FirstOrDefault(x => x.Id == id);// first or default use garda fast hucha where vanda if (employee != null) { employee.Name = models.Name; employee.Description = models.Description; employee.Price = models.Price; } contest.SaveChanges(); return(true); } }
public int Save(ProductModals modal) { using (var database = new PrkStoreEntities()) { tblProduct CategoryTB = new tblProduct() { Name = modal.Name, Description = modal.Description, Price = modal.Price }; database.tblProduct.Add(CategoryTB); database.SaveChanges(); return(CategoryTB.Id); } }
public ActionResult Edit(int id, ProductModals modal) { var result = process.Edit(id, modal); return(RedirectToAction("Index")); }