コード例 #1
0
        public async Task <IActionResult> CreateTourDetails(TourDetailsDTO tourDetailsDto)
        {
            var tourDetails = _mapper.Map <TourDetailsDTO, TourDetails>(tourDetailsDto);
            await _repository.AddTourDetails(tourDetails);

            return(Ok(tourDetails));
        }
コード例 #2
0
 public async Task <IActionResult> UpdateTourDetails(int id, TourDetailsDTO tourDetailsDto)
 {
     if (id != tourDetailsDto.Id)
     {
         return(BadRequest());
     }
     try
     {
         var tourDetails = _mapper.Map <TourDetailsDTO, TourDetails>(tourDetailsDto);
         await _repository.UpdateTourDetails(tourDetails);
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!await TourDetailsExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }