public void UpdateAverageReviewScore(Lodging aLodging, double newAverageReviewScore)
 {
     try
     {
         aLodging.ReviewsAverageScore = newAverageReviewScore;
         lodgingRepository.Update(aLodging);
     }
     catch (ServerException e)
     {
         throw new ServerBusinessLogicException("No se ha podido actualizar el promedio del puntaje de reviews del hospedaje " +
                                                "debido a que ha ocurrido un error.", e);
     }
 }
Exemplo n.º 2
0
        public Lodging Update(int id)
        {
            var actualLodging = LodgingRepository.GetFirst(x => x.Id == id && x.IsDeleted == false);

            if (actualLodging == null)
            {
                throw new NotFoundException("Id");
            }

            actualLodging.IsFull = !actualLodging.IsFull;

            LodgingRepository.Update(actualLodging);
            LodgingRepository.Save();

            return(LodgingRepository.GetFirst(x => x.Id == actualLodging.Id, "TouristSpot,Images"));
        }