public ActionResult Edit(Activity monitor)
        {
            if (ModelState.IsValid)
            {
                var driver         = db.Drivers.Find(monitor.Deliverer);
                var parker         = db.Drivers.Find(monitor.Parkedby);
                var missingdrivers = false;
                if (driver == null)
                {
                    ModelState.AddModelError("Deliverer", "This Driver hasn't clocked in..");
                    missingdrivers = true;
                }
                if (parker == null)
                {
                    ModelState.AddModelError("Parkedby", "This Driver hasn't clocked in..");
                    missingdrivers = true;
                }
                if (!missingdrivers)
                {
                }

                db.Entry(monitor).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.TicketNumber = new SelectList(db.OwnersInformations, "TicketNumber", "FirstName", monitor.TicketNumber);
            return(View(monitor));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "EmployeeId,Firstname,LastName,Email")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "DriversId,Firstname,LastName,TimeIn,In,Out,TimeOut")] Driver driver)
 {
     if (ModelState.IsValid)
     {
         db.Entry(driver).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(driver));
 }
示例#4
0
 public ActionResult Edit([Bind(Include = "TicketNumber,FirstName,LastName,Make,Model,Color,LicensePlate,ParkedLocation,ParkedBy,exp")] OwnersInformation ownersInformation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownersInformation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParkedBy = new SelectList(db.Drivers, "DriversId", "Firstname", ownersInformation.ParkedBy);
     return(View(ownersInformation));
 }