public ActionResult New(NewItemForm form) { if (!ModelState.IsValid) { return View(form); } _context.Items.Add(new Item { ItemName = form.ItemName, ItemCode = form.ItemCode, Price = form.Price, }); _context.SaveChanges(); return RedirectToAction<ItemController>(c => c.Index()) .WithSuccess("Item created!"); }
public ActionResult New() { var form = new NewItemForm(); return View(form); }