private void SetBestPrice(OffersDto offersDto) { var offersList = offersDto.Offers.ToList().OrderBy(o => o.Price); offersList.FirstOrDefault()?.SetAsBestPrice(); offersDto.Offers = offersList; }
public OffersDto Update(OffersDto offer) { var myOffer = mapper.Map <Offer>(offer); var newOffer = offerRepository.Update(myOffer); unitOfWork.Commit(); return(mapper.Map <OffersDto>(newOffer)); }
public OffersDto Add(OffersDto newOffer) { var offer = mapper.Map <Offer>(newOffer); var addedOffer = offerRepository.Add(offer); unitOfWork.Commit(); return(mapper.Map <OffersDto>(addedOffer)); }
public IActionResult Put(OffersDto offer) { return(Ok(offerService.Update(offer))); }
public IActionResult Post(OffersDto offer) { return(Ok(offerService.Add(offer))); }