public IActionResult Delete(Band band) { using (var db = new BandsDbContext()) { db.Bands.Remove(band); db.SaveChanges(); return(RedirectToAction("Index")); } }
public IActionResult Create(Band band) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } using (var db = new BandsDbContext()) { db.Bands.Add(band); db.SaveChanges(); } return(RedirectToAction("Index")); }