public async Task <IActionResult> UpgradeAccountPlan(IndexViewModel model, IFormCollection collection) { string newSubscriptonSelection = model.PaymentViewModel.SubscriptionPlan; var user = await GetCurrentUserAsync(); if (user != null) { using (_dbContext) { var dbUser = _dbContext.Users.Find(user.Id); //Process subscription payment string stripeToken = collection["stripeToken"]; StripeSubscription stripeSubscription = _stripeService.SubscribeToPlan(dbUser, stripeToken, newSubscriptonSelection); dbUser.SubscriptionPlan = newSubscriptonSelection; dbUser.StripeCustomerId = stripeSubscription.CustomerId; dbUser.MonthlyPromotionLimitReached = false; _dbContext.SaveChanges(); } return(RedirectToAction(nameof(Index), new { Message = ManageMessageId.AccountUpdateSuccess })); } return(RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error })); }