public ActionResult Index(BugReportInputModel model) { if (!this.ModelState.IsValid) { return this.View(model); } this.reportService.Create(model.Content, model.Email); return this.RedirectToAction("Index", "Home", new { area = string.Empty }); }
public void ShouldMapPostNewBugWithParameters() { string url = "/Public/Report"; const string ContentOfTheBug = "This is the content of the bug!"; const string EmailOfTheBug = "*****@*****.**"; var report = new BugReportInputModel() { Content = ContentOfTheBug, Email = EmailOfTheBug }; this.routeCollection .ShouldMap(url) .WithFormUrlBody($"Content={ ContentOfTheBug }&Email={ EmailOfTheBug }") .To<ReportController>(c => c.Index(report)); }