예제 #1
0
        static void Main(string[] args)
        {
            var mt = new MovieTheater(10, 10);

            mt.AddChair(new Chair(5, 5));
            mt.AddChair(new Chair(3, 6, true));

            Console.Write(mt);

            var movie = new Movie
            {
                Title       = "It, a coisa",
                ReleaseDate = new DateTime(2019, 09, 5),
                Genre       = "Terror, Thriller",
                Rating      = new Rating("NC-17", 17),
                Synopsis    = "Vinte e sete anos depos, o clube dos perdedores cresceu e se mudou, depois de um telefonema devastador eles irão retornar."
            };

            movie.ArtistList.Add(new Artist("james McAvoy"));
            movie.ArtistList.Add(new Artist("Javier Botet"));
            movie.ArtistList.Add(new Artist("Jessica Chastain"));
            movie.DirectorList.Add(new Artist("Andy Muschietti"));
            Console.WriteLine(movie);
            Console.WriteLine("UnB Cine Flix");
        }
예제 #2
0
 public async Task <IActionResult> CreateChair([Bind("MovieTheaterNumber,AddressCompanyId,Row,Col")] Chair chair)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var movieTheater = new MovieTheater(await _context.MovieTheaters
                                                 .Include(m => m.Chairs)
                                                 .FirstOrDefaultAsync(m => (m.AddressCompanyId == chair.AddressCompanyId && m.MovieTheaterNumber == chair.MovieTheaterNumber)));
             movieTheater.AddChair(chair);
             _context.Add(chair);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateException e)
         {
             Debug.Write(e);
             TempData["erro"] = e.Message;
             return(RedirectToAction(nameof(CreateChair), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
         }
         catch (ArgumentException e)
         {
             Debug.Write(e);
             TempData["erro"] = e.Message;
             return(RedirectToAction(nameof(CreateChair), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
         }
         TempData["mensage"] = "Chair Create Success";
         return(RedirectToAction(nameof(Details), new { chair.AddressCompanyId, chair.MovieTheaterNumber }));
     }
     //ViewData["AddressCompanyId"] = new SelectList(_context.AddressCompanies, "Id", "Name", movieTheater.AddressCompanyId);
     return(View());
 }