public ActionResult Create(ProductsPicture productPicture) { tbl_products_tra tblproduct = productPicture.tblProducts; db.Entry(tblproduct).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Products")); }
public ActionResult Cancel(int id) { tbl_products_tra tblproduct = db.tbl_products_tra.Find(id); db.tbl_products_tra.Remove(tblproduct); db.SaveChanges(); return(RedirectToAction("Index", "Products")); }
public ActionResult DeleteConfirmed(int id) { tbl_products_tra tbl_products_tra = db.tbl_products_tra.Find(id); db.tbl_products_tra.Remove(tbl_products_tra); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(tbl_products_tra tbl_product) { if (ModelState.IsValid) { db.tbl_products_tra.Add(tbl_product); db.SaveChanges(); } return(View(tbl_product)); }
public ActionResult Create([Bind(Include = "id_products_tra,img_products_tra,img1_products_tra,img2_products_tra,img3_products_tra,name_products_tra,code_products_tra,des_products_tra,status_products_tra,newprice_products_tra,oldprice_products_tra")] tbl_products_tra tbl_products_tra) { if (ModelState.IsValid) { db.tbl_products_tra.Add(tbl_products_tra); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbl_products_tra)); }
// GET: Products/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_products_tra tbl_products_tra = db.tbl_products_tra.Find(id); if (tbl_products_tra == null) { return(HttpNotFound()); } return(View(tbl_products_tra)); }
// GET: Products/Delete/5 public ActionResult Delete(int?id) { tbl_products_tra tbl_products_tra = db.tbl_products_tra.Find(id); List <tblSysPicture> list = (from t in db.tblSysPictures where t.advert_id == id select t).ToList(); foreach (tblSysPicture item in list) { db.tblSysPictures.Remove(item); } db.SaveChanges(); db.tbl_products_tra.Remove(tbl_products_tra); db.SaveChanges(); return(RedirectToAction("Index")); }