There is a Create.cshtml page with the Create() method and a Create2.cshtml page with the Create2() method.
How to make it so that by the button in Create.cshtml thrown to the Create2.cshtml page and already by the button in Create2.cshtml this whole thing has already been saved?
Here are the methods:
[HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "Id,Name")] Test_Run test_Run) { if (ModelState.IsValid) { //чо-то делается return View("Create2", test_Run); } return View(test_Run); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create2(Test_Run test_Run) { { //чо-то делается, а потом сохраняем db.Test_Runs.Add(test_Run); db.SaveChanges(); return RedirectToAction("Index"); } return View(test_Run); } Buttons in both submit views, but when I poke a button in the second view, the first one validates, and the Create2() method does not get at all