示例#1
0
        public ActionResult ScheduledPickUp()
        {
            CustomerSchedulePU item = _context.CustomerSchedulePUs.Where(c => c.IdentityUserId == this.User.FindFirstValue(ClaimTypes.NameIdentifier)).SingleOrDefault();

            if (item == null)
            {
                return(View("CreateScheduledPickUp"));
            }
            else
            {
                return(View(item));
            }
        }
示例#2
0
 public ActionResult CreateSchedulePU(CustomerSchedulePU customerSchedulePU)
 {
     try
     {
         var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
         var customer = _context.Customers.Where(c => c.IdentityUserId == userId).SingleOrDefault();
         customerSchedulePU.IdentityUserId = userId;
         customerSchedulePU.Address        = customer.Address;
         customerSchedulePU.ZipCode        = customer.ZipCode;
         _context.CustomerSchedulePUs.Add(customerSchedulePU);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }