public async Task <ActionResult> AddressAndPayment(FormCollection values) { var order = new Order(); TryUpdateModel(order); if (ModelState.IsValid && string.Equals(values["PromoCode"], PromoCode, StringComparison.OrdinalIgnoreCase)) { order.Username = User.Identity.Name; order.OrderDate = DateTime.Now; _storeContext.Orders.Add(order); await ShoppingCart.GetCart(_storeContext, this).CreateOrder(order); await _storeContext.SaveChangesAsync(); PerformanceHelper.IncrementCounter(MusicStorePerformanceConstants.PaymentsCounterName); return(RedirectToAction("Complete", new { id = order.OrderId })); } return(View(order)); }
public ActionResult LogOff() { AuthenticationManager.SignOut(); PerformanceHelper.IncrementCounter(MusicStorePerformanceConstants.LogoffCounterName); return(RedirectToAction("Index", "Home")); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { var user = await _userManager.FindAsync(model.UserName, model.Password); if (user != null) { await SignInAsync(user, model.RememberMe); PerformanceHelper.IncrementCounter(MusicStorePerformanceConstants.LoginCounterName); return(RedirectToLocal(returnUrl)); } ModelState.AddModelError("", "Invalid username or password."); } return(View(model)); }