public ActionResult DeleteConfirmed(int id) { Cateparent cateparent = db.Cateparents.Find(id); db.Cateparents.Remove(cateparent); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CateparentID,CateparentName")] Cateparent cateparent) { if (ModelState.IsValid) { db.Entry(cateparent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cateparent)); }
public ActionResult Create([Bind(Include = "CateparentID,CateparentName")] Cateparent cateparent) { if (ModelState.IsValid) { db.Cateparents.Add(cateparent); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cateparent)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cateparent cateparent = db.Cateparents.Find(id); if (cateparent == null) { return(HttpNotFound()); } return(View(cateparent)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Product product = db.Products.Include(s => s.FileDetails).SingleOrDefault(x => x.ProductID == id); if (product == null) { return(HttpNotFound()); } Cate temp = db.Cates.Where(s => s.CateID == product.CateID).FirstOrDefault(); Cateparent temp2 = db.Cateparents.Where(s => s.CateparentID == product.CateparentID).FirstOrDefault(); ViewBag.Cateparent = temp.CateName; ViewBag.CateName = temp2.CateparentName; return(View(product)); }