public void UpdateAdd(Succulent succulent) { db.Configuration.ValidateOnSaveEnabled = false; db.Entry(succulent).State = EntityState.Modified; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; }
public ActionResult DeleteConfirmed(int id) { Succulent succulent = db.Succulent.Find(id); db.Succulent.Remove(succulent); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SucculentID,SucculentName,CategoryID,Photo,Feature,Application,BreedMode,CollectedTotal,SucculentImg")] Succulent succulent) { if (ModelState.IsValid) { db.Entry(succulent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.SucculentCategory, "SucculentCategoryID", "SucculentCategoryName", succulent.CategoryID); return(View(succulent)); }
// GET: SucculentManagement/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Succulent succulent = db.Succulent.Find(id); if (succulent == null) { return(HttpNotFound()); } return(View(succulent)); }
// GET: SucculentManagement/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Succulent succulent = db.Succulent.Find(id); if (succulent == null) { return(HttpNotFound()); } ViewBag.CategoryID = new SelectList(db.SucculentCategory, "SucculentCategoryID", "SucculentCategoryName", succulent.CategoryID); return(View(succulent)); }
public ActionResult Create(Succulent succulent) { if (ModelState.IsValid) { if (succulentmanager.SelectName(succulent.SucculentName) == null) { succulentmanager.Create(succulent); return(RedirectToAction("Succulent_Details")); } else { return(Content("<script>alert('该多肉已经存在');window.open('" + Url.Content("~/Succulent/Create") + "', '_self')</script>")); } } ViewBag.CategoryID = new SelectList(succulentcategorymanager.Select(), "SucculentCategoryID", "SucculentCategoryName", succulent.CategoryID); return(View(succulent)); }
public void Create(Succulent succulent) { db.Succulent.Add(succulent); db.SaveChanges(); }
public void UpdateAdd(Succulent succulent) { isucculent.UpdateAdd(succulent); }
public void Create(Succulent succulent) { isucculent.Create(succulent); }