public async Task<ActionResult> Index() {
            HttpContext ctx = System.Web.HttpContext.Current;


            var pcats = CURTAPI.GetParentCategoriesAsync();
            await Task.WhenAll(new Task[] { pcats });

            ViewBag.parent_cats = await pcats;

            // Instantiate our Customer object
            Customer cust = new Customer();

            // Retrieve from Session/Cookie
            cust.GetFromStorage(ctx);

            if (!cust.LoggedIn(ctx)) {
                return RedirectToAction("Index","Authenticate");
            }

            // Get the Customer record
            cust.Get();

            cust.BindAddresses();

            ViewBag.countries = UDF.GetCountries();
            ViewBag.cust = cust;
            ViewBag.error = TempData["error"];
            return View();
        }
 public ActionResult SetShippingDefault(int id = 0) {
     HttpContext ctx = System.Web.HttpContext.Current;
     Customer cust = new Customer();
     cust.GetFromStorage(ctx);
     if (!cust.LoggedIn(ctx)) {
         return RedirectToAction("Index", "Authenticate");
     }
     Address a = new Address().Get(id);
     if (a.cust_id == cust.ID) {
         cust.SetShippingDefaultAddress(id);
         cust.BindAddresses();
     }
     return RedirectToAction("Addresses");
 }
        public ActionResult Index()
        {
            // Instantiate our Customer object
            Customer cust = new Customer();

            // Retrieve from Session/Cookie
            cust.GetFromStorage();

            // Get the Customer record
            cust.Get();

            cust.BindAddresses();

            ViewBag.countries = UDF.GetCountries();
            ViewBag.cust = cust;
            ViewBag.error = TempData["error"];
            return View();
        }
 public ActionResult SetShippingDefault(int id = 0)
 {
     Customer cust = new Customer();
     cust.GetFromStorage();
     Address a = new Address().Get(id);
     if (a.cust_id == cust.ID) {
         cust.SetShippingDefaultAddress(id);
         cust.BindAddresses();
     }
     return RedirectToAction("Addresses");
 }