示例#1
0
        public ActionResult UpdateAddress(string newAddress, string newPostal)
        {
            string result;

            if (Session["User"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (string.IsNullOrEmpty(newAddress) && string.IsNullOrEmpty(newPostal))
            {
                return(RedirectToAction("Index", "ShoppingCart"));
            }

            User user = (User)Session["User"];

            if (!string.IsNullOrEmpty(newAddress))
            {
                result = db.UpdateAddress(user.ID, newAddress);
            }
            if (!string.IsNullOrEmpty(newPostal))
            {
                result = db.UpdatePostal(user.ID, newPostal);
            }
            return(RedirectToAction("Index", "ShoppingCart"));
        }