Exemplo n.º 1
0
        public async Task <IActionResult> CreateTourPrice(TourPriceDTO tourPriceDto)
        {
            var tourPrice = _mapper.Map <TourPriceDTO, TourPrice>(tourPriceDto);
            await _tourPriceRepository.Add(tourPrice);

            return(CreatedAtAction(nameof(GetTourPrice), new { id = tourPrice.TourPriceId }, tourPrice));
        }
Exemplo n.º 2
0
 public async Task <IActionResult> UpdateTourPrice(int id, TourPriceDTO tourPriceDto)
 {
     if (id != tourPriceDto.TourPriceId)
     {
         return(BadRequest());
     }
     try
     {
         var tourPrice = _mapper.Map <TourPriceDTO, TourPrice>(tourPriceDto);
         await _tourPriceRepository.Update(id, tourPrice);
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!await TourPriceExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }