private void TestVolunteersInRange()
        {
            ApplicationUser beneficiary = new ApplicationUser();

            beneficiary.Latitude  = 47.034654; //47.034654, 21.946378
            beneficiary.Longitude = 21.946378;

            ApplicationUser user1 = new ApplicationUser();

            user1.Latitude  = 47.032416;
            user1.Longitude = 21.950669;
            user1.UserName  = "******";
            user1.RangeInKm = 8; //8000;

            ApplicationUser user2 = new ApplicationUser();

            user2.Latitude  = 47.035795; //47.035795, 21.945959
            user2.Longitude = 21.945959;
            user2.UserName  = "******";
            user2.RangeInKm = 15; //15000;

            ApplicationUser user3 = new ApplicationUser();

            user3.Latitude  = 47.111343; //47.111343, 21.892237
            user3.Longitude = 21.892237;
            user3.UserName  = "******";
            user3.RangeInKm = 8; //8000;

            List <ApplicationUser> volunteers = new List <ApplicationUser>();

            volunteers.Add(user1);
            volunteers.Add(user2);
            volunteers.Add(user3);

            IQueryable <ApplicationUser> qV = volunteers.AsQueryable <ApplicationUser>();

            var result = _volunteerMatchingService.GetVolunteersInRange(qV, beneficiary, 8).ToList(); //8000

            var resultVolunteer1 = _volunteerMatchingService.IsInRange(user1, beneficiary);
            var resultVolunteer2 = _volunteerMatchingService.IsInRange(user2, beneficiary);
            var resultVolunteer3 = _volunteerMatchingService.IsInRange(user3, beneficiary);
        }
Esempio n. 2
0
        public List <ApplicationUser> GetVolunteersInRangeForBeneficiary(ApplicationUser beneficiary, int radiusInKm)
        {
            IQueryable <ApplicationUser> volunteers = _volunteerRepository.GetVolunteers();

            return(_volunteerMatchingService.GetVolunteersInRange(volunteers, beneficiary, radiusInKm).ToList());
        }