public ApartmentController(IApartmentRepository aRepo, ILocationRepository lRepo, IContext con, IImageRepository img)
 {
     AptRepo = aRepo;
     LocRepo = lRepo;
     context = con;
     imageRepo = img;
 }
        public Apartment Put(Guid id, ApartmentDTO value)
        {
            Apartment model = IApartmentRepository.Get(id);

            if (value.apartmentName != null)
            {
                model.apartmentName = value.apartmentName;
            }
            if (value.maxPersons != 0)
            {
                model.maxPersons = value.maxPersons;
            }
            if (value.description != null)
            {
                model.description = value.description;
            }
            if (value.numberOfRooms != 0)
            {
                model.numberOfRooms = value.numberOfRooms;
            }
            if (value.pricePerNight != 0)
            {
                model.pricePerNight = value.pricePerNight;
            }
            return(IApartmentRepository.Update(model));
        }
Пример #3
0
 public HomeControllerTest()
 {
     profileRepository = new EFProfileRepository();
     apartmentRepository = new EFApartmentsRepository();            
     applicationManager = new ApplicationManager(new UserStore<ApplicationUser>(new ApplicationDbContext()));
     
 }
Пример #4
0
 public UserController(IUserRepository repository, IApartmentRepository apRepository, IPropertyRepository propRepository,
                       IReservationRepository resRepository)
 {
     IUserRepository        = repository;
     IApartmentRepository   = apRepository;
     IPropertyRepository    = propRepository;
     IReservationRepository = resRepository;
 }
        // CONSTRUCTORS
        public RequestsController(IUnitOfWork unitOfWork)
        {
            this.unitOfWork = unitOfWork;

            this.requestRepository   = unitOfWork.GetRepository <Request, RequestRepository>();
            this.userRepository      = null;
            this.apartmentRepository = null;
        }
Пример #6
0
 public EmployeeTravelController(UserManager <Employee> userManager, IEmployeeTravelRepository employeeTravelRepository, IEmployeeRepository employeeRepository, ITravelRepository travelRepository, IApartmentRepository apartmentRepository, IOfficeRepository officeRepository)
 {
     _userManager = userManager;
     _employeeTravelRepository = employeeTravelRepository;
     _employeeRepository       = employeeRepository;
     _travelRepository         = travelRepository;
     _apartmentRepository      = apartmentRepository;
     _officeRepository         = officeRepository;
 }
Пример #7
0
 public TenantController(ILandlordRepository ll, IApartmentRepository a, 
                         ILocationRepository lo, ITenantRepository t, IContext con)
 {
     TRepo = t;
     AptRepo = a;
     LocRepo = lo;
     LLRepo = ll;
     context = con;
 }
 public LocationController(ILandlordRepository ll, IApartmentRepository a,
     ILocationRepository lo, ITenantRepository t, IContext con, IImageRepository img)
 {
     TRepo = t;
     AptRepo = a;
     LocRepo = lo;
     LLRepo = ll;
     context = con;
     imageRepo = img;
 }
Пример #9
0
        public IEnumerable <GetApartmentQueryResult> GetAllWithoutCondominium(
            [FromServices] IApartmentRepository repository,
            [FromServices] IMapper mapper
            )
        {
            var user   = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value;
            var result = repository.GetAllWithoutCondominium(user).ToList();

            return(mapper.Map <List <GetApartmentQueryResult> >(result));
        }
Пример #10
0
 public PropertyController(IPropertyRepository propertyrepository, ICityRepository cityrepository, IUserRepository userrepository,
                           IApartmentRepository apartmentrepository, IReservationRepository reservationrepository, IPhotoRepository photoRepository)
 {
     IPropertyRepository    = propertyrepository;
     ICityRepository        = cityrepository;
     IUserRepository        = userrepository;
     IApartmentRepository   = apartmentrepository;
     IReservationRepository = reservationrepository;
     IPhotoRepository       = photoRepository;
 }
 public HomeownerService(
     IReservationRepository reservationRepository,
     IApartmentRepository apartmentRepository,
     ITenantRepository tenantRepository,
     IPremiumTenantCalculationStrategy premiumTenantCalculationStrategy)
 {
     this.reservationRepository            = reservationRepository;
     this.apartmentRepository              = apartmentRepository;
     this.tenantRepository                 = tenantRepository;
     this.premiumTenantCalculationStrategy = premiumTenantCalculationStrategy;
 }
 public HomeownerController(
     IApartmentRepository apartmentRepository,
     IHomeownerRepository homeownerRepository,
     IHomeownerService homeownerService,
     ITenantRepository tenantRepository)
 {
     this.apartmentRepository = apartmentRepository;
     this.homeownerRepository = homeownerRepository;
     this.homeownerService    = homeownerService;
     this.tenantRepository    = tenantRepository;
 }
        public ApartmentsController(IApartmentRepository repo, IConfiguration config, IMapper mapper, IOptions <CloudinarySettings> cloudinarySettings)
        {
            this.repo               = repo;
            this.config             = config;
            this.mapper             = mapper;
            this.cloudinarySettings = cloudinarySettings;
            Account acc = new Account(
                cloudinarySettings.Value.CloudName,
                cloudinarySettings.Value.ApiKey,
                cloudinarySettings.Value.ApiSecret);

            cloudinary = new Cloudinary(acc);
        }
        public Apartment Post(ApartmentDTO value)
        {
            Apartment model = new Apartment()
            {
                apartmentName = value.apartmentName,
                numberOfRooms = value.numberOfRooms,
                description   = value.description,
                pricePerNight = value.pricePerNight,
                propertyId    = value.propertyId
            };

            return(IApartmentRepository.Create(model));
        }
Пример #15
0
 public TenantController(
     IReservationService reservationService,
     IReservationRepository reservationRepository,
     ITenantRepository tenantRepository,
     IApartmentRepository apartmentRepository,
     IHomeownerRepository homeownerRepository,
     IPriceCalculationStrategy priceCalculationStrategy)
 {
     this.reservationService       = reservationService;
     this.reservationRepository    = reservationRepository;
     this.tenantRepository         = tenantRepository;
     this.apartmentRepository      = apartmentRepository;
     this.homeownerRepository      = homeownerRepository;
     this.priceCalculationStrategy = priceCalculationStrategy;
 }
Пример #16
0
        public List <PropertyDetailsDTO> Get()
        {
            List <Property>           AllProperties = IPropertyRepository.GetAll();
            List <PropertyDetailsDTO> PropertiesDTO = new List <PropertyDetailsDTO>();

            foreach (Property p in AllProperties)
            {
                PropertyDetailsDTO MyProperty = new PropertyDetailsDTO()
                {
                    id            = p.id,
                    name          = p.name,
                    type          = p.type,
                    description   = p.description,
                    numberOfStars = p.numberOfStars,
                    street        = p.street,
                    country       = p.country,
                    cityName      = p.cityName,
                    userId        = p.userId,
                    photo         = p.photo,
                    mapLatitude   = p.mapLatitude,
                    mapLongitude  = p.mapLongitude,
                    isPublic      = p.isPublic
                };
                int numberOfReservations = 0;
                int allRatings           = 0;

                IEnumerable <Apartment> apartments = IApartmentRepository.GetAll().Where(x => x.propertyId == p.id);
                foreach (Apartment ap in apartments)
                {
                    IEnumerable <Reservation> reservations = IReservationRepository.GetAll().Where(x => x.apartmentId == ap.id);
                    foreach (Reservation res in reservations)
                    {
                        if (res.rating != 0)
                        {
                            allRatings += res.rating;
                            numberOfReservations++;
                        }
                    }
                }
                if (numberOfReservations != 0)
                {
                    MyProperty.averageRating = allRatings / numberOfReservations;
                }
                PropertiesDTO.Add(MyProperty);
            }

            return(PropertiesDTO);
        }
Пример #17
0
 public UnitOfWork(MapDbContext context, IApartmentRepository apartmentRepository,
                   IRepository <City> cityRepository, IRepository <Country> countryRepository,
                   IRepository <House> houseRepository, IResidentRepository residentRepository,
                   IRepository <Street> streetRepository, IRepository <ApartmentResidents> apartmentResidentsRepository,
                   UserManager <User> userManager, SignInManager <User> signInManager)
 {
     _context                     = context;
     ApartmentRepository          = apartmentRepository;
     CityRepository               = cityRepository;
     CountryRepository            = countryRepository;
     HouseRepository              = houseRepository;
     ResidentRepository           = residentRepository;
     StreetRepository             = streetRepository;
     ApartmentResidentsRepository = apartmentResidentsRepository;
     UserManager                  = userManager;
     SignInManager                = signInManager;
 }
Пример #18
0
        public PropertyDetailsDTO Get(Guid id)
        {
            Property           Property   = IPropertyRepository.Get(id);
            PropertyDetailsDTO MyProperty = new PropertyDetailsDTO()
            {
                id            = Property.id,
                name          = Property.name,
                type          = Property.type,
                description   = Property.description,
                numberOfStars = Property.numberOfStars,
                street        = Property.street,
                country       = Property.country,
                cityName      = Property.cityName,
                userId        = Property.userId,
                photo         = Property.photo,
                mapLatitude   = Property.mapLatitude,
                mapLongitude  = Property.mapLongitude,
                isPublic      = Property.isPublic
            };

            int numberOfReservations = 0;
            int allRatings           = 0;

            IEnumerable <Apartment> apartments = IApartmentRepository.GetAll().Where(x => x.propertyId == MyProperty.id);

            foreach (Apartment ap in apartments)
            {
                IEnumerable <Reservation> reservations = IReservationRepository.GetAll().Where(x => x.apartmentId == ap.id);
                foreach (Reservation res in reservations)
                {
                    if (res.rating != 0)
                    {
                        allRatings += res.rating;
                        numberOfReservations++;
                    }
                }
            }
            if (numberOfReservations != 0)
            {
                float average = (float)allRatings / (float)numberOfReservations;
                MyProperty.averageRating = average;
            }
            return(MyProperty);
        }
Пример #19
0
 public ApartmentService(IApartmentRepository _apartmentRep,
                         IAvailableToGuestService _availableToGuestService,
                         ITypeOfHousingService _typeOfHousingService,
                         IApartmentComfortService _apartmentComfortService,
                         IImageService _imageService,
                         ICountryService _countryService,
                         ICityService _cityService,
                         IApartmentComfortRepository _apartmentComfortRep,
                         IApartmentImageRepository _apartmentImageRep)
 {
     apartmentRep            = _apartmentRep;
     availableToGuestService = _availableToGuestService;
     typeOfHousingService    = _typeOfHousingService;
     apartmentComfortService = _apartmentComfortService;
     imageService            = _imageService;
     countryService          = _countryService;
     cityService             = _cityService;
     apartmentComfortRep     = _apartmentComfortRep;
     apartmentImageRep       = _apartmentImageRep;
 }
        public Apartment Put(int id, ApartmentDTO value)
        {
            Apartment model = IApartmentRepository.Get(id);

            if (value.description != null)
            {
                model.description = value.description;
            }
            if (value.numberOfRooms != 0)
            {
                model.numberOfRooms = value.numberOfRooms;
            }
            if (value.propertyId != 0)
            {
                model.propertyId = value.propertyId;
            }
            if (value.pricePerNight != 0)
            {
                model.pricePerNight = value.pricePerNight;
            }
            return(IApartmentRepository.Update(model));
        }
Пример #21
0
        public ActionResult <UserDTO> Get(Guid id)
        {
            User    user    = IUserRepository.Get(id);
            UserDTO userDTO = new UserDTO()
            {
                id                = user.id,
                firstName         = user.firstName,
                lastName          = user.lastName,
                sex               = user.sex,
                birthDate         = user.birthDate,
                bankAccount       = user.bankAccount,
                email             = user.email,
                password          = user.password,
                isOwner           = user.isOwner,
                profilePhoto      = user.profilePhoto,
                address           = user.address,
                phoneNumber       = user.phoneNumber,
                country           = user.country,
                cityName          = user.cityName,
                isMailVerificated = user.isMailVerificated,
                cardHolderName    = user.cardHolderName
            };
            List <Reservation>     allReservations = new List <Reservation>();
            IEnumerable <Property> myProperties    = IPropertyRepository.GetPropertiesByUser(userDTO.id);

            foreach (Property p in myProperties)
            {
                IEnumerable <Apartment> myapartments = IApartmentRepository.GetApartmentsByPropertyId(p.id);
                foreach (Apartment ap in myapartments)
                {
                    IEnumerable <Reservation> myReservations = IReservationRepository.GetReservationsByApartment(ap.id);
                    allReservations.AddRange(myReservations.ToList());
                }
            }
            userDTO.userPropertiesReservations = allReservations;
            return(userDTO);
        }
Пример #22
0
 public HomeController(IApartmentRepository apartmentRepo, IClientRepository clientsRepo)
 {
     apartmentRepository = apartmentRepo;
     clientsRepository = clientsRepo;
 }
Пример #23
0
 public AccountController(IApartmentRepository repository)
 {
     _repository = repository;
 }
Пример #24
0
 public Apartments(IApartmentRepository repo)
 {
     repo = repo;
 }
 public ApartmentService(IApartmentRepository apartmentService)
 {
     _apartmentRepository = apartmentService;
 }
Пример #26
0
 //
 // GET: /Apartment/
 public ApartmentsController(IApartmentRepository apartmentRepository, IProfileRepository profileRepository)
 {
     ApartmentRepository = apartmentRepository;
     ProfileRepository   = profileRepository;
 }
Пример #27
0
 public HomeController(IProfileRepository profileRepository, IApartmentRepository apartmentRepository,ApplicationUser userRepository)
 {
     ProfileRepository = profileRepository;
     ApartmentRepository = apartmentRepository;
     user=userRepository;
 }
Пример #28
0
 public UpdateApartmentHandler(IApartmentRepository apartmentRepository)
 {
     this.apartmentRepository = apartmentRepository;
 }
Пример #29
0
 public ApartmentService(IApartmentRepository apartmentRepository, IUnitOfWork unitOfWork)
 {
     this._apartmentRepository = apartmentRepository;
     this._unitOfWork          = unitOfWork;
 }
Пример #30
0
 public HomeController(IProfileRepository profileRepository, IApartmentRepository apartmentRepository, IApplicationManager applicationUser)
 {
     _profileRepository   = profileRepository;
     _apartmentRepository = apartmentRepository;
     _applicationUser     = applicationUser;
 }
Пример #31
0
 public PersonService()
 {
     _personRepository    = new PersonRepository();
     _personMapper        = new PersonMapper();
     _apartmentRepository = new ApartmentRepository();
 }
Пример #32
0
 public CondominiumHandler(ICondominiumRepository repository, IApartmentRepository apartmentRepository)
 {
     _repository          = repository;
     _apartmentRepository = apartmentRepository;
 }
Пример #33
0
 //
 // GET: /Apartment/
 public ApartmentsController(IApartmentRepository apartmentRepository, IProfileRepository profileRepository)
 {
     ApartmentRepository = apartmentRepository;
     ProfileRepository = profileRepository;
 }
Пример #34
0
 public ApartmentService()
 {
     _apartmentRepository = new ApartmentRepository();
     _apartmentMapper     = new ApartmentMapper();
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="ApartmentRepository"></param>
 public ApartmentController(IApartmentRepository ApartmentRepository)
 {
     _ApartmentRepository = ApartmentRepository;
 }
Пример #36
0
 public ResidentHandler(IResidentRepository repository, IApartmentRepository apartmentRepository)
 {
     _repository          = repository;
     _apartmentRepository = apartmentRepository;
 }
Пример #37
0
 public AccountController()
 {
     _repository = new ApartmentRepo(new ApplicationDbContext());
 }