コード例 #1
0
        public PagedResponse <ProjectionQueryDto> Execute(ProjectionSearch search)
        {
            var query = _context.Projections.Include(x => x.Movie).Include(x => x.Festival).ThenInclude(x => x.Place).AsQueryable();

            if (!string.IsNullOrEmpty(search.MovieName) && !string.IsNullOrWhiteSpace(search.MovieName))
            {
                query = query.Where(x => x.Movie.Name.ToLower().Contains(search.MovieName.ToLower()));
            }

            if (search.LocationID is int)
            {
                query = query.Where(x => x.Hall.LocationID == search.LocationID);
            }

            if (search.FestivalID is int)
            {
                query = query.Where(x => x.FestivalID == search.FestivalID);
            }

            if (search.HallID is int)
            {
                query = query.Where(x => x.HallID == search.HallID);
            }

            if (search.MovieID is int)
            {
                query = query.Where(x => x.MovieID == search.MovieID);
            }

            return(query.Paged <ProjectionQueryDto, Projection>(search, _mapper));
        }
コード例 #2
0
 public IActionResult Get([FromQuery] ProjectionSearch search, [FromServices] IGetProjectionsQuery query)
 {
     return(Ok(_executor.ExecuteQuery(query, search)));
 }