public ActionResult Create(storeproduct st) { try { db.storeproducts.Add(st); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { storeproduct storepro = db.storeproducts.Where(x => x.product_ID == id).FirstOrDefault(); db.storeproducts.Remove(storepro); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, storeproduct storepro) { try { db.Entry(storepro).State = EntityState.Modified; db.SaveChanges(); // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View()); } }