public ActionResult DeleteConfirmed(int id) { product_class product_class = db.product_class.Find(id); db.product_class.Remove(product_class); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,c_time,c_id,u_time,u_id,switch,sort,name,banner,banner_url,banner1,banner_url1,banner2,banner_url2,img,img_url,img1,img_url1,img2,img_url2,img3,img_url3,img4,img_url4,banner_action,img_action,index_,remark")] product_class product_class) { if (ModelState.IsValid) { db.Entry(product_class).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product_class)); }
// GET: product_class/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } product_class product_class = db.product_class.Find(id); if (product_class == null) { return(HttpNotFound()); } return(View(product_class)); }
public ActionResult Create([Bind(Include = "id,c_time,c_id,u_time,u_id,switch,sort,name,banner,banner_url,banner1,banner_url1,banner2,banner_url2,img,img_url,img1,img_url1,img2,img_url2,img3,img_url3,img4,img_url4,banner_action,img_action,index_,remark")] product_class product_class, HttpPostedFileBase file_banner) { //if (ModelState.IsValid && file_banner != null) if (file_banner != null) { if (file_banner.ContentLength > 0) { string path = Path.Combine(Server.MapPath("~/image/product_class/"), file_banner.FileName); file_banner.SaveAs(path); } product_class.banner = file_banner.FileName; db.product_class.Add(product_class); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product_class)); }