Пример #1
0
 public IActionResult Delete(Band band)
 {
     using (var db = new BandsDbContext())
     {
         db.Bands.Remove(band);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
Пример #2
0
        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"));
        }