コード例 #1
0
        public void ChangeShippingInfoRepo(string userId, ChangeShippingInputModel newShippingInfo)
        {
            var change = (from u in _db.shipingInfo
                          where u.aspUserIdForShipping == userId
                          select u).FirstOrDefault();

            if (change == null)
            {
                ShippingInfo shiping = new ShippingInfo
                {
                    address = newShippingInfo.address,
                    city    = newShippingInfo.city,
                    country = newShippingInfo.country,
                    zipCode = newShippingInfo.zipCode,
                    aspUserIdForShipping = userId
                };
                addShippingAddresToDataBase(shiping);
            }
            else
            {
                change.address = newShippingInfo.address;
                change.city    = newShippingInfo.city;
                change.country = newShippingInfo.country;
                change.zipCode = newShippingInfo.zipCode;
            }
            _db.SaveChanges();
        }
コード例 #2
0
        public async Task <IActionResult> ChangeShippingDetailsInCart(ChangeShippingInputModel changeShipping)
        {
            if (ModelState.IsValid)
            {
                var user = await GetCurrentUserAsync();

                var userId = user?.Id;
                if (userId == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                _accountServices.changeShippingInfoServ(userId, changeShipping);

                return(RedirectToAction("CheckOut", "Account"));
            }
            return(RedirectToAction("CheckOut", "Account"));
        }
コード例 #3
0
 public void changeShippingInfoServ(string UserId, ChangeShippingInputModel newShipInfoService)
 {
     _accountRepo.ChangeShippingInfoRepo(UserId, newShipInfoService);
 }