public ActionResult DeleteConfirmed(int id) { UserPlantSet userPlantSet = db.UserPlantSet.Find(id); db.UserPlantSet.Remove(userPlantSet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,PlantId,UserId,PlantWaterFrq,PlantPruningFrq,PlantFertilizerFrq,PlantMistFrq,StartDate,EndDate,Active")] UserPlantSet userPlantSet) { if (ModelState.IsValid) { db.Entry(userPlantSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlantId = new SelectList(db.PlantSet, "Id", "PlantCommonName", userPlantSet.PlantId); return(View(userPlantSet)); }
// GET: Dashboard/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserPlantSet userPlantSet = db.UserPlantSet.Find(id); if (userPlantSet == null) { return(HttpNotFound()); } return(View(userPlantSet)); }
// GET: Dashboard/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserPlantSet userPlantSet = db.UserPlantSet.Find(id); if (userPlantSet == null) { return(HttpNotFound()); } ViewBag.PlantId = new SelectList(db.PlantSet, "Id", "PlantCommonName", userPlantSet.PlantId); return(View(userPlantSet)); }
public ActionResult Create([Bind(Include = "Id,PlantId,UserId,PlantWaterFrq,PlantPruningFrq,PlantFertilizerFrq,PlantMistFrq,StartDate,EndDate,Active")] UserPlantSet userPlantSet) { userPlantSet.UserId = User.Identity.GetUserId(); ModelState.Clear(); TryValidateModel(userPlantSet); if (ModelState.IsValid) { db.UserPlantSet.Add(userPlantSet); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlantId = new SelectList(db.PlantSet, "Id", "PlantCommonName", userPlantSet.PlantId); return(View(userPlantSet)); }