public ActionResult Create(GigFormViewModel viewModel) { if (!ModelState.IsValid) { viewModel.Genres = _context.Genres.ToList(); return(View("Create", viewModel)); } var gig = new Gig() { ArtistId = User.Identity.GetUserId(), Venue = viewModel.Venue, DateTime = viewModel.DataTime(), GenreId = viewModel.Genre }; _context.Gigs.Add(gig); _context.SaveChanges(); return(RedirectToAction("Index", "Home")); }