public IActionResult Review(SponsorshipModel model) { if (ModelState.IsValid) { //Can't trust the totals that come in so reset those var subTotal = (_businessOptions.PricePerEpisode * model.NumberOfEpisodes); var gst = (subTotal * 0.05m); var total = Math.Round((subTotal + gst), 2); var correctedAmountModel = new SponsorshipModel { Email = model.Email, Name = model.Name, NumberOfEpisodes = model.NumberOfEpisodes, Tagline = model.Tagline, Website = model.Website, Notes = model.Notes, Gst = gst, SubTotal = subTotal, Total = (subTotal + gst), StripeAmount = (int)(total * 100), StripeKey = _stripeOptions.Key }; return(View(correctedAmountModel)); } return(View("Index", model)); }
public IActionResult Index(int numberOfEpisodes = 5, string sponsorName = "") { var model = new SponsorshipModel { Email = string.Empty, Name = sponsorName, NumberOfEpisodes = Math.Max(1, numberOfEpisodes), Notes = string.Empty, Tagline = string.Empty, Website = string.Empty }; return(View(model)); }