public async Task <List <MovieDto> > GetNowShowingAsync() { List <string> screeningIncludes = new List <string> { nameof(Screening.Movie) }; var screenings = await _screeningRepo.GetAsync(x => x.DateAndTime >= DateTime.UtcNow, screeningIncludes); List <Movie> moviesList = screenings.Select(x => x.Movie).Distinct().ToList(); List <MovieDto> dtoList = _mapper.Map <List <MovieDto> >(moviesList); return(dtoList); }
private async Task <bool> ValidateStatusChange(int screeningId) { Screening screening = await _screeningRepo.GetAsync(screeningId); if (screening == null || screening.DateAndTime <= DateTime.UtcNow) { return(false); } if (screening.DateAndTime <= DateTime.UtcNow) { return(false); } return(true); }
public async Task <ScreeningDto> GetByIdAsync(int id, ICollection <string> includes = null) { var entity = await _screeningRepo.GetAsync(id, includes); return(_mapper.Map <ScreeningDto>(entity)); }