public ViewResult BillingAddress() { // TODO: Get Billing address from your model var model = new BillingAddress(); return View(model); }
public ActionResult BillingAddress(BillingAddress model) { if (ModelState.IsValid) { // TODO: Call your service to save the billing address // TempData.Add("flash", new FlashSuccessViewModel("Your billing address has been saved.")); return RedirectToAction("Index"); } return View(model); }
public async Task<ActionResult> BillingAddress(BillingAddress model) { if (ModelState.IsValid) { var userId = User.Identity.GetUserId(); // Call your service to save the billing address var user = await UserManager.FindByIdAsync(userId); user.BillingAddress = model; await UserManager.UpdateAsync(user); // Model Country has to be 2 letter ISO Code if (!string.IsNullOrEmpty(model.Vat) && !string.IsNullOrEmpty(model.Country) && EuropeanVat.Countries.ContainsKey(model.Country)) { await UpdateSubscriptionTax(userId, 0); } else if (!string.IsNullOrEmpty(model.Country) && EuropeanVat.Countries.ContainsKey(model.Country)) { await UpdateSubscriptionTax(userId, EuropeanVat.Countries[model.Country]); } TempData.Add("flash", new FlashSuccessViewModel("Your billing address has been saved.")); return RedirectToAction("Index"); } return View(model); }