예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WaterUnderstanding waterUnderstanding = db.WaterUnderstanding.Find(id);

            db.WaterUnderstanding.Remove(waterUnderstanding);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        // 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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        // 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));
        }