Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Crops crops = db.Crops.Find(id);

            db.Crops.Remove(crops);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,CropName,Variety,SownDate,PlantedDate,GerminationDate,HarvestDate,LocationIdRef,yield,satisfaction,notes")] Crops crops)
 {
     if (ModelState.IsValid)
     {
         db.Entry(crops).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LocationIdRef = new SelectList(db.locations, "LocationId", "LocationName", crops.LocationIdRef);
     return(View(crops));
 }
Esempio n. 3
0
        // GET: Crops/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Crops crops = db.Crops.Find(id);

            if (crops == null)
            {
                return(HttpNotFound());
            }
            return(View(crops));
        }
Esempio n. 4
0
        // GET: Crops/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Crops crops = db.Crops.Find(id);

            if (crops == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LocationIdRef = new SelectList(db.locations, "LocationId", "LocationName", crops.LocationIdRef);
            return(View(crops));
        }