Ejemplo n.º 1
0
 public TouristSpot GetTouristSpotById(Guid touristSpotId)
 {
     try
     {
         TouristSpot touristSpotObteined = touristSpotRepository.Get(touristSpotId);
         return(touristSpotObteined);
     }
     catch (ClientException e)
     {
         throw new ClientBusinessLogicException(MessageExceptionBusinessLogic.ErrorNotFindTouristSpot, e);
     }
     catch (ServerException e)
     {
         throw new ServerBusinessLogicException(MessageExceptionBusinessLogic.ErrorObteinedTouristSpot, e);
     }
 }
Ejemplo n.º 2
0
        public Lodging Create(Lodging lodging)
        {
            var touristSpot = TouristSpotRepository.Get(lodging.TouristSpot.Id);

            if (touristSpot == null)
            {
                throw new NotFoundException("TouristSpot");
            }

            if (LodgingRepository.Exists(x => x.Address == lodging.Address && x.IsDeleted == false))
            {
                throw new NotUniqueException("Address");
            }

            lodging.TouristSpot = touristSpot;
            LodgingRepository.Add(lodging);
            LodgingRepository.Save();

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