Esempio n. 1
0
        public ActionResult Create(PickupDB pickupdb)
        {
            List<string> PropertyNames = new List<string>() { "firstn", "lastn", "number", "address", "pincode" };

            if (PropertyNames.Any(p => !ModelState.IsValidField(p)))
            {
                return View(pickupdb);                    // Error
            }
            else
            {
                return RedirectToAction("Date", pickupdb);     // Everything is okay
            }
        }
Esempio n. 2
0
 public ActionResult Edit(PickupDB pickupdb)
 {
     List<string> PropertyNames = new List<string>() { "firstn", "lastn", "number", "address", "pincode" };
     if (PropertyNames.Any(p => !ModelState.IsValidField(p)))
     {
         return View(pickupdb);                    // Error
     }
     else
     {
         db.Entry(pickupdb).State = EntityState.Modified;
         db.Configuration.ValidateOnSaveEnabled = false;
         db.SaveChanges();
         return RedirectToAction("Index", "Home");
     }
 }