Beispiel #1
0
        public ActionResult MyScheduledPickup()
        {
            CustomerSchedPickUp item = _context1.CustomerSchedPickUps.Where(c => c.IdentityUserId == this.User.FindFirstValue(ClaimTypes.NameIdentifier)).SingleOrDefault();

            if (item == null)
            {
                return(View("CreateScheduledPickUp"));
            }
            else
            {
                return(View(item));
            }
        }
Beispiel #2
0
        public ActionResult Edit(CustomerSchedPickUp item)
        {
            try
            {
                var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var temp   = _context1.CustomerSchedPickUps.Where(c => c.IdentityUserId == userId).SingleOrDefault();
                temp.Address            = item.Address;
                temp.DayOfWeek          = item.DayOfWeek;
                temp.SuspendedStartDate = item.SuspendedStartDate;
                temp.SuspendedEndDate   = item.SuspendedEndDate;

                _context1.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #3
0
        public ActionResult CreateScheduledPickUp(CustomerSchedPickUp customerSchedPickUp)
        {
            try
            {
                // TODO: Add insert logic here
                var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                var customer = _context1.Customers.Where(c => c.IdentityUserId == userId).SingleOrDefault();

                customerSchedPickUp.IdentityUserId = userId;
                customerSchedPickUp.Address        = customer.Address;
                customerSchedPickUp.City           = customer.City;
                customerSchedPickUp.ZipCode        = customer.ZipCode;
                _context1.CustomerSchedPickUps.Add(customerSchedPickUp);
                _context1.SaveChanges();
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }