コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            IncompatibleAgriculture incompatibleAgriculture = db.IncompatibleAgricultures.Find(id);

            db.IncompatibleAgricultures.Remove(incompatibleAgriculture);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,FirstCulureId,SecondCulureId")] IncompatibleAgriculture incompatibleAgriculture)
 {
     if (ModelState.IsValid)
     {
         db.Entry(incompatibleAgriculture).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.FirstCulureId  = new SelectList(db.AgricultureTypes, "Id", "Name", incompatibleAgriculture.FirstCulureId);
     ViewBag.SecondCulureId = new SelectList(db.AgricultureTypes, "Id", "Name", incompatibleAgriculture.SecondCulureId);
     return(View(incompatibleAgriculture));
 }
コード例 #3
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IncompatibleAgriculture incompatibleAgriculture = db.IncompatibleAgricultures.Find(id);

            if (incompatibleAgriculture == null)
            {
                return(HttpNotFound());
            }
            return(View(incompatibleAgriculture));
        }
コード例 #4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IncompatibleAgriculture incompatibleAgriculture = db.IncompatibleAgricultures.Find(id);

            if (incompatibleAgriculture == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FirstCulureId  = new SelectList(db.AgricultureTypes, "Id", "Name", incompatibleAgriculture.FirstCulureId);
            ViewBag.SecondCulureId = new SelectList(db.AgricultureTypes, "Id", "Name", incompatibleAgriculture.SecondCulureId);
            return(View(incompatibleAgriculture));
        }