public async Task<ActionResult> Create(Item item) { if (ModelState.IsValid) { _context.Items.Add(item); await _context.SaveChangesAsync(); return RedirectToAction("Index", "Item"); } return View(item); }
public async Task<ActionResult> Edit(int id, Item item) { item.ItemId = id; _context.Items.Attach(item); _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return RedirectToAction("Index", "Item"); }