Exemplo 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
            }
        }
Exemplo 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");
     }
 }