public IActionResult Create(Format format)
 {
     if (ModelState.IsValid)
     {
         _db.Add(format);
         _db.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(format));
 }
Example #2
0
 public IActionResult CreatePost()
 {
     if (!ModelState.IsValid)
     {
         AlbumVM.Artists = _db.Artists.ToList();
         return(View(AlbumVM));
     }
     _db.Add(AlbumVM.Album);
     _db.SaveChanges();
     return(RedirectToAction(nameof(Index)));
 }