public ActionResult Checkout(int id, Guid?token) { if (!User.Identity.IsAuthenticated && token.HasValue) { var user = authAdapter.ValidateAuthToken(token.Value); if (user.StatusCode == 200) { CustomAuthentication.SetAuthCookie(user.Result.Username, user.Result.UserId, true); return(RedirectToAction("checkout")); } } var status = this.orderAdapter.GetOrderForCheckout(User.Identity.Name, id); if (status.StatusCode != 200) { return(this.NotFoundException()); } Rentler.Web.Models.OrderCheckoutModel model = new Rentler.Web.Models.OrderCheckoutModel() { Order = status.Result, Input = new Rentler.Web.Models.OrderCheckoutInputModel() }; // auto-select the first payment method if (status.Result.User.UserCreditCards.Count > 0) { model.Input.SelectedPaymentMethod = status.Result.User.UserCreditCards.First(); } return(View(model)); }
public ActionResult Checkout(int id, Guid? token) { if (!User.Identity.IsAuthenticated && token.HasValue) { var user = authAdapter.ValidateAuthToken(token.Value); if (user.StatusCode == 200) { CustomAuthentication.SetAuthCookie(user.Result.Username, user.Result.UserId, true); return RedirectToAction("checkout"); } } var status = this.orderAdapter.GetOrderForCheckout(User.Identity.Name, id); if (status.StatusCode != 200) return this.NotFoundException(); Rentler.Web.Models.OrderCheckoutModel model = new Rentler.Web.Models.OrderCheckoutModel() { Order = status.Result, Input = new Rentler.Web.Models.OrderCheckoutInputModel() }; // auto-select the first payment method if (status.Result.User.UserCreditCards.Count > 0) model.Input.SelectedPaymentMethod = status.Result.User.UserCreditCards.First(); return View(model); }