public static async Task <PagedList <Collection> > GetCollectionsAsync(CollectionDtoParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } var queryExpression = _context.Collection.Where(x => x.Midex == parameters.Midex) as IQueryable <Collection>; return(await PagedList <Collection> .CreateAsync(queryExpression, parameters.PageNumber, parameters.PageSize)); }
public static async Task <PagedList <News> > GetNewsByMidex(CollectionDtoParameters parameters) { Maintable maintable = GetMuseumByMidex(parameters.Midex); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } var queryExpression = _context.News.Where(x => x.Museum == maintable.Mname) as IQueryable <News>; return(await PagedList <News> .CreateAsync(queryExpression, parameters.PageNumber, parameters.PageSize)); //return await _context.News.Where(x => x.Museum == maintable.Mname).ToListAsync(); }
public async Task <IActionResult> GetCollectionsByMidex([FromQuery] CollectionDtoParameters parameters) { var collections = await MuseumSystem.GetCollectionsAsync(parameters); return(Json(new { code = 0, data = new { items = collections, total = collections.TotalCount } })); }