public IActionResult Put([FromBody] AccommodationPutModelIn accommodationPutModelIn)
 {
     try
     {
         AccommodationPutQueryIn accommodationPutQueryIn = new AccommodationPutQueryIn(accommodationPutModelIn);
         this.accommodationLogic.Update(accommodationPutQueryIn);
         return(Ok(this.accommodationLogic.GetByName(accommodationPutQueryIn.Name)));
     }
     catch (ObjectNotFoundInDatabaseException ex)
     {
         return(NotFound("There is no accommodation with such id."));
     }
     catch (NullReferenceException e)
     {
         return(NotFound("There is no accommodation with such id."));
     }
     catch (Exception e)
     {
         return(StatusCode(500, "Internal Server Error"));
     }
 }
 public void Update(AccommodationPutQueryIn accommodationPutQueryIn)
 {
     try
     {
         if (accommodationPutQueryIn.ChangeCapacity)
         {
             this.accommodationRepository.UpdateCapacity(
                 accommodationPutQueryIn.Name, accommodationPutQueryIn.FullCapacity);
         }
         List <ImageWrapper> imagesToAdd           = new List <ImageWrapper>();
         Accommodation       accommodationToUpdate = this.GetByName(accommodationPutQueryIn.Name);
         imagesToAdd = StringToImageWrapper(accommodationPutQueryIn.Images, accommodationToUpdate.Id);
         if (imagesToAdd.Count > 0)
         {
             this.accommodationRepository.AddImages(accommodationPutQueryIn.Name, imagesToAdd);
         }
     }
     catch (ObjectNotFoundInDatabaseException e)
     {
         throw new ObjectNotFoundInDatabaseException();
     }
 }