Example #1
0
 public IActionResult Create(Band band)
 {
     using (var db = new BandRegisterDbContext())
     {
         db.Add(band);
         db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
Example #2
0
        public IActionResult Create(string name, string members, double honorarium, string genre)
        {
            Band newBand = new Band
            {
                Name       = name,
                Members    = members,
                Honorarium = honorarium,
                Genre      = genre
            };

            using (var db = new BandRegisterDbContext())
            {
                db.Add(newBand);
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }