Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PickupStatus pickupStatus = db.PickupStatus.Find(id);

            db.PickupStatus.Remove(pickupStatus);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,CustomerId,StatusOfPickup")] PickupStatus pickupStatus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pickupStatus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerId = new SelectList(db.Customers, "Id", "FirstName", pickupStatus.CustomerId);
     return(View(pickupStatus));
 }
Пример #3
0
        // GET: PickupStatus/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PickupStatus pickupStatus = db.PickupStatus.Find(id);

            if (pickupStatus == null)
            {
                return(HttpNotFound());
            }
            return(View(pickupStatus));
        }
Пример #4
0
        // GET: PickupStatus/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PickupStatus pickupStatus = db.PickupStatus.Find(id);

            if (pickupStatus == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CustomerId = new SelectList(db.Customers, "Id", "FirstName", pickupStatus.CustomerId);
            return(View(pickupStatus));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,CustomerId,StatusOfPickup")] PickupStatus pickupStatus)
        {
            if (ModelState.IsValid)
            {
                db.PickupStatus.Add(pickupStatus);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            var currentUsername = User.Identity.Name;
            var currentUser     = db.Users.Where(m => m.UserName == currentUsername).Select(m => m.Id).FirstOrDefault();
            var employee        = db.Employees.Where(m => m.ApplicationUserId == currentUser).FirstOrDefault();
            var employeeZipCode = employee.ZipCode;
            var dayOfTheWeek    = DateTime.Now.DayOfWeek.ToString();
            var customerPickups = db.Customers.Where(c => c.ZipCode == employeeZipCode).Where(c => c.PickupDay == dayOfTheWeek).ToList();

            ViewBag.CustomerId = new SelectList(customerPickups, "Id", "FirstName", pickupStatus.CustomerId);
            return(View(pickupStatus));
        }
Пример #6
0
 public Customer()
 {
     pickupStatus = PickupStatus.Pending;
     dueBalance   = 0;
 }