public async Task <ICommandResult> Handle(CreateBoxOfficeCommand command) { //Verifica se o e-mail já está sendo utilizado if (await _userRepository.GetUserByEmail(command.Email) != null) { AddNotification("email", "Este e-mail já está sendo utilizado"); } var boxOffice = new BoxOffice(command.Name, command.Email, command.Password); AddNotifications(boxOffice.Notifications); if (!IsValid()) { return(null); } //Faz a persistencia no banco await _boxOfficeRepository.Create(boxOffice); await _boxOfficeRepository.Commit(); //retorna o resultado para tela return(new CreateBoxOfficeCommandResult( boxOffice.Id, boxOffice.Name, boxOffice.Email )); }
static bool RunTests() { try { //creating cinema BoxOffice bx = new BoxOffice(); bx.SetupBoxOffice(); Cinema village = new Cinema() { Name = "The Village", Address = new Address() { StreetAddress = "123 fake str." }, DefaultTicketPrice = 11.99 }; village.CreateTheater("Theater 7", 7, 3); village.CreateShowtime(village.Theaters[0], bx.Movies.Find(m => m.Title == "Black Panther"), "12:00 PM"); village.PrintShowtimes(); village.ShowAvailableTickets(village.Showtimes[0]); } catch (Exception error) { System.Console.WriteLine(error.Message); return(false); } return(true); }
public MovieTheater(List <Movie> mv) { BoxOffice = new BoxOffice(); movies = mv; }
public override List <IMovie> Mine() { var result = new List <IMovie>(); var boxOfficeHistory = new List <IBoxOffice>(); string url = $"{Url}{Identifier.Replace("?ref", "weekend/?ref")}"; // Wan't only the weekend values. Daily might be handy later. var web = new HtmlWeb(); ContainsEstimates = false; var doc = web.Load(url); UrlSource = url; // Get table rows (skipping the first row - header) var tableRows = doc.DocumentNode?.SelectNodes("//table//tr[position()>1]"); if (tableRows != null) { foreach (var row in tableRows) { IBoxOffice boxOffice = null; var rowColumns = row.SelectNodes("td"); if (rowColumns != null) { int columnCount = 0; foreach (var column in rowColumns) { if (columnCount == 0) { boxOffice = new BoxOffice { WeekendEnding = ParseEndDate(HttpUtility.HtmlDecode(column.InnerText)) }; } else if (columnCount == 1) { boxOffice.Rank = Convert.ToInt32(column.InnerText); } else if (columnCount == 2) { boxOffice.Earnings = ParseEarnings(column.InnerText); } else if (columnCount == 4) { boxOffice.TheaterCount = ParseInt(column.InnerText); break; } columnCount++; } } if (boxOffice != null) { boxOfficeHistory.Add(boxOffice); } } var movie = new Movie { Identifier = Identifier }; movie.SetBoxOfficeHistory(boxOfficeHistory); result.Add(movie); // A list of one (just to conform to the miner interface) } return(result); }
public MovieTheater() { BoxOffice = new BoxOffice(); Movies = new List <Movie>(); }