public ActionResult AuthenticationMethod(CheckoutViewModel viewModel) { if (ModelState.IsValidField("UserName")) { if (viewModel.IsPassword ?? true) { if (string.IsNullOrEmpty(viewModel.Password)) { ModelState.AddModelError("Password", "Vui lòng nhập Password"); } else { if (WebSecurity.Login(viewModel.UserName, viewModel.Password)) { viewModel.CurrentStep = CheckoutStep.BillingInfo; } else ModelState.AddModelError("Password", "Password không đúng"); } } else { viewModel.CurrentStep = CheckoutStep.BillingInfo; } ModelErrorClear(ModelState); } this.Session[CHECKOUT_SESSION_KEY] = viewModel; return View("Index", viewModel); }
public ActionResult DeliveryInformation(CheckoutViewModel viewModel) { if (ModelState.IsValidField("CustomerName") && ModelState.IsValidField("OrderAddress") && ModelState.IsValidField("PhoneNumber")) { ModelErrorClear(ModelState); CheckoutViewModel model = this.Session[CHECKOUT_SESSION_KEY] as CheckoutViewModel; if (model != null) { model.CurrentStep = CheckoutStep.PaymentInfo; model.CustomerName = viewModel.CustomerName; model.OrderAddress = viewModel.OrderAddress; model.PhoneNumber = viewModel.PhoneNumber; model.OrderDescription = viewModel.OrderDescription; this.Session[CHECKOUT_SESSION_KEY] = model; return View("Index", model); } else return Index(); } viewModel.CurrentStep = CheckoutStep.BillingInfo; return View("Index", viewModel); }