Beispiel #1
0
        private void SetBestPrice(OffersDto offersDto)
        {
            var offersList = offersDto.Offers.ToList().OrderBy(o => o.Price);

            offersList.FirstOrDefault()?.SetAsBestPrice();

            offersDto.Offers = offersList;
        }
Beispiel #2
0
        public OffersDto Update(OffersDto offer)
        {
            var myOffer  = mapper.Map <Offer>(offer);
            var newOffer = offerRepository.Update(myOffer);

            unitOfWork.Commit();
            return(mapper.Map <OffersDto>(newOffer));
        }
Beispiel #3
0
        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)));
 }