In asp.net mvc, how do I redirect to the edit view after I create a record?
I'm working on a custom crm application. I would like to create the initial contact and then redirect to edit screen. In the application, I need to have the initial customer record created before additional information about the customer can be entered.
I tried this:
if (ModelState.IsValid) { _context.Add(contacts); await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); return RedirectToAction("Edit", new { ContactNumber = contacts.ContactNumber }); } return View(contacts);
It almost worked.
It redirect to /customers/edit?9 instead of /customers/edit/9. Can someone tell me what I did wrong?
Thanks!
0 comments:
Post a Comment