public async Task <IActionResult> Get([FromQuery] PageFilter pageFilter, [FromQuery] OfferViewModelFilter filter) { Expression <Func <Offer, bool> > offerFilter = OfferFilter.ConvertTo(filter); offerFilter = offerFilter.AndAlso(x => x.Active == true); PagedFilter <Offer> pagedFilter = new PagedFilter <Offer>(pageFilter.Page, pageFilter.Limit, offerFilter); Expression <Func <Offer, object> >[] includes = new Expression <Func <Offer, object> >[] { x => x.Employer, x => x.OfferType }; PagedResult <Offer> offers = await _offerService.Get(pagedFilter, include : includes); IEnumerable <OfferViewModel> offerViewModel = OfferViewModel.From(offers.Data); PagedResult <OfferViewModel> queryResult = new PagedResult <OfferViewModel>(offerViewModel, offers.Page, offers.Limit, offers.ElementsCount); return(Ok(queryResult)); }
public ResponseItem Get() { User user = HttpContext.Items["user"] as User; List <Offer> offers = _offerService.Get(user.Id); List <OfferPiped> pipedOffers = GetPipedOffers(offers); return(new ResponseItem("success", pipedOffers)); }
// GET: api/Offer/5 public IHttpActionResult Get(int id) { return(Ok(offerService.Get(id))); }