public IEnumerable <SeanceInfo> GetSeances() { List <SeanceInfo> seancei = new List <SeanceInfo>(); var seances = _seanceService.GetAllSeances().ToList(); foreach (Seances seance in seances) { if (DateTime.Now <= seance.DateSeance) { var cinemasinfo = _cinemasService.getCinemaofSeance(seance.IdCinema); var filmsinfo = _filmsService.getFilmofSeance(seance.IdFilm); seancei.Add(new SeanceInfo { SeanceId = seance.Id, CinemaId = seance.IdCinema, CinemaName = cinemasinfo.Name, FilmId = seance.IdFilm, FilmName = filmsinfo.Name, DateSeance = seance.DateSeance, TimeSeance = seance.TimeSeance, Price = seance.Price, CountSeats = seance.Count_Seats }); } } return(seancei); }
public async Task <IActionResult> GetOrders(string iduser) { var orders = await Task.Run(() => _orderService.getOrdersId(iduser)); if (orders == null) { return(NotFound()); } List <OrdersInfoVM> ordersInfo = new List <OrdersInfoVM>(); foreach (Orders ord in orders) { var seanceinfo = _seanceService.getSeanceofOrder(ord.IdSeance); foreach (Seances seance in seanceinfo) { var cinemasinfo = _cinemasService.getCinemaofSeance(seance.IdCinema); var filmsinfo = _filmsService.getFilmofSeance(seance.IdFilm); ordersInfo.Add(new OrdersInfoVM { OrderId = ord.Id, CinemaId = cinemasinfo.Id, CinemaName = cinemasinfo.Name, FilmId = filmsinfo.Id, FilmName = filmsinfo.Name, DateSeance = seance.DateSeance, TimeSeance = seance.TimeSeance, Price = seance.Price, SeanceId = seance.Id, PlaceNumber = ord.IdSeat }); } } return(Ok(ordersInfo)); }