示例#1
0
        public ActionResult Create(GigFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Genres = _context.Genre.ToList();
                return(View("GigForm", model));
            }

            var gig = Gig.NewGig(model.GetDateTime(), User.Identity.GetUserId(), model.Genre, model.Venue);

            _context.Gig.Add(gig);
            _context.SaveChanges();

            return(RedirectToAction("Mine", "Gigs"));
        }