public static OfferViewModel From(Offer offer) { return(new OfferViewModel() { Id = offer.Id, Description = offer.Description, Employer = EmployerDto.From(offer.Employer), OfferType = OfferTypeDto.From(offer.OfferType), Active = offer.Active, OfferTypeName = offer.OfferType.Name }); }
public async Task <IActionResult> Get([FromQuery] PageFilter pageFilter) { PagedFilter <OfferType> pagedFilter = new PagedFilter <OfferType>(pageFilter.Page, pageFilter.Limit); var offerTypes = await _offerTypeService.Get(pagedFilter); var offerTypesDto = OfferTypeDto.From(offerTypes.Data); PagedResult <OfferTypeDto> queryResult = new PagedResult <OfferTypeDto>(offerTypesDto, offerTypes.Page, offerTypes.Limit, offerTypes.ElementsCount); return(Ok(queryResult)); }