public ActionResult DeleteConfirmed(int id) { WaterUnderstanding waterUnderstanding = db.WaterUnderstanding.Find(id); db.WaterUnderstanding.Remove(waterUnderstanding); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "WaterUnderstandingID,HouseholdID,WaterReductionID,WaterSupplier,FamilyUsage,IndividualUsage,SavingBills,WaterReductionWhy,UpdateDate")] WaterUnderstanding waterUnderstanding) { if (ModelState.IsValid) { db.Entry(waterUnderstanding).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HouseholdID = new SelectList(db.Households, "HouseholdID", "WPnumber", waterUnderstanding.HouseholdID); ViewBag.WaterReductionID = new SelectList(db.WaterReductions, "WaterReductionID", "Type", waterUnderstanding.WaterReductionID); return(View(waterUnderstanding)); }
// GET: WaterUnderstandings/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WaterUnderstanding waterUnderstanding = db.WaterUnderstanding.Find(id); if (waterUnderstanding == null) { return(HttpNotFound()); } return(View(waterUnderstanding)); }
public ActionResult Create([Bind(Include = "WaterUnderstandingID,HouseholdID,WaterReductionID,WaterSupplier,FamilyUsage,IndividualUsage,SavingBills,WaterReductionWhy,UpdateDate")] WaterUnderstanding waterUnderstanding, string returnUrl) { ViewBag.returnUrl = returnUrl; if (ModelState.IsValid) { db.WaterUnderstanding.Add(waterUnderstanding); db.SaveChanges(); return(Redirect(returnUrl)); } ViewBag.HouseholdID = new SelectList(db.Households, "HouseholdID", "WPnumber", waterUnderstanding.HouseholdID); ViewBag.WaterReductionID = new SelectList(db.WaterReductions, "WaterReductionID", "Type", waterUnderstanding.WaterReductionID); return(View(waterUnderstanding)); }
// GET: WaterUnderstandings/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WaterUnderstanding waterUnderstanding = db.WaterUnderstanding.Find(id); if (waterUnderstanding == null) { return(HttpNotFound()); } ViewBag.HouseholdID = new SelectList(db.Households, "HouseholdID", "WPnumber", waterUnderstanding.HouseholdID); ViewBag.WaterReductionID = new SelectList(db.WaterReductions, "WaterReductionID", "Type", waterUnderstanding.WaterReductionID); return(View(waterUnderstanding)); }