private static void ImportSeat(SeatDto seatDto) { string cinemaTown = seatDto.CinemaTown; TownValidator.CheckTownExisting(cinemaTown); int townId = TownService.GetTownId(cinemaTown); string cinemaName = seatDto.CinemaName; CinemaValidator.CheckCinemaExisting(cinemaName, townId); int cinemaId = CinemaService.GetCinemaId(cinemaName, townId); byte auditoriumNumber = seatDto.AuditoriumNumber; AuditoriumValidator.CheckAuditoriumExists(auditoriumNumber, cinemaId, cinemaName); int auditoriumId = AuditoriumService.GetAuditoriumId(auditoriumNumber, cinemaId); int row = seatDto.Row; int number = seatDto.Number; SeatValidator.ValidateSeatDoesntExist(number, auditoriumId, auditoriumNumber); SeatService.AddSeat(number, row, auditoriumId); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.SeatAddedSuccess, number, auditoriumNumber, cinemaName, cinemaTown)); }
public void IsFreeSeatTest() { List <SeatModel> Seats = new List <SeatModel>() { new SeatModel { IsReserve = false }, new SeatModel { IsReserve = false }, new SeatModel { IsReserve = true }, new SeatModel { IsReserve = false }, new SeatModel { IsReserve = true } }; SeatValidator validator = new SeatValidator(Seats); Assert.IsTrue(validator.IsSeatValid(1) == true); Assert.IsTrue(validator.IsSeatValid(2) == true); Assert.IsTrue(validator.IsSeatValid(3) == false); Assert.IsTrue(validator.IsSeatValid(4) == true); Assert.IsTrue(validator.IsSeatValid(5) == false); Assert.IsTrue(validator.IsSeatValid(22) == false); }
public ActionResult SeatsDataMovie(int id) { var seatsData = DataProcessor.LoadSeatsData(id); seatValidator = new SeatValidator(seatsData); NumberMovie = id; return(View(seatsData)); }
public SeatImportService() { this.auditoriumService = new AuditoriumService(); this.cinemaService = new CinemaService(); this.auditoriumValidator = new AuditoriumValidator(auditoriumService); this.cinemaValidator = new CinemaValidator(cinemaService); this.townService = new TownService(); this.townValidator = new TownValidator(townService); this.seatService = new SeatService(); this.seatValidator = new SeatValidator(seatService); }