Example #1
0
        public ActionResult CheckShip()
        {
            if (_cart.Lines.Count() == 0)
            {
                TempData["message"] = "Your cart is empty!";
                return(RedirectToAction("Index", "Cart"));
            }
            var order = new Order {
            };

            if (User.Identity.IsAuthenticated)
            {
                order.UserID = User.Identity.Name.ToString().ToUpper();
                ShipInfo userInfo = _shipRepo.SearchResult(order.UserID);
                if (userInfo != null)
                {
                    order.Name  = userInfo.FirstName + " " + userInfo.LastName;
                    order.Add1  = userInfo.Add1;
                    order.Add2  = userInfo.Add2;
                    order.City  = userInfo.City;
                    order.State = userInfo.State;
                    order.Zip   = userInfo.Zip;
                }
            }
            return(View(order));
        }
        public async Task <IActionResult> EditShip()
        {
            var _user = await _UserManager.FindByNameAsync(User.Identity.Name);

            ShipInfo preShip = _repo.SearchResult(_user.UserName.ToUpper());
            ShipInfo newShip = new ShipInfo {
            };

            if (preShip != null)
            {
                return(View(preShip));
            }
            newShip.Zip = _user.Zip;
            return(View(newShip));
        }