Exemplo n.º 1
0
 public void UpdateAdd(Succulent succulent)
 {
     db.Configuration.ValidateOnSaveEnabled = false;
     db.Entry(succulent).State = EntityState.Modified;
     db.SaveChanges();
     db.Configuration.ValidateOnSaveEnabled = true;
 }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Succulent succulent = db.Succulent.Find(id);

            db.Succulent.Remove(succulent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
        // 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));
        }
Exemplo n.º 5
0
        // 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));
        }
Exemplo n.º 6
0
 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));
 }
Exemplo n.º 7
0
 public void Create(Succulent succulent)
 {
     db.Succulent.Add(succulent);
     db.SaveChanges();
 }
Exemplo n.º 8
0
 public void UpdateAdd(Succulent succulent)
 {
     isucculent.UpdateAdd(succulent);
 }
Exemplo n.º 9
0
 public void Create(Succulent succulent)
 {
     isucculent.Create(succulent);
 }