예제 #1
0
        public async Task <IActionResult> Create([Bind("EventosId,NomeDoEvento,CapacidadeDoevento,QuantidadeDeIngressos,DataDoEvento,ValorDoIngresso,GeneroDoEvento,CasasDeShowId")] Eventos eventos)
        {
            if (ModelState.IsValid)
            {
                ViewBag.casa = _cacontext.CasasDeShow.ToList();
                _context.Add(eventos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CasasDeShowId"] = new SelectList(_context.Set <CasasDeShow>(), "CasasDeShowId", "CasasDeShowId", eventos.CasasDeShowId);
            return(View(eventos));
        }
 public async Task <bool> SaveChangesAsync()
 {
     return((await _context.SaveChangesAsync()) > 0);
 }