public IEnumerable <ShopGridViewModel> Read(string address, ref Dictionary <int, string> foodCategories)
        {
            var dto           = _repository.Read(address, ref foodCategories).ToList();
            var addressCoords = _geoLocation.CalculateLatLong(address);

            dto.Update(x => x.Distance = Math.Round(_geoLocation.CalculateDistance(address, addressCoords, x)));

            return(dto.Where(x => x.Distance < 10000));
        }
Exemple #2
0
        public int CreateUserShopOwner(UserInformation user, ShopInformation shop)
        {
            user.IsShopOwner = true;
            var id = CreateUser(user);

            shop.OwnerId = id;

            var coords = _geoLocation.CalculateLatLong(shop.Address);

            shop.Latitude  = coords.Latitude;
            shop.Longitude = coords.Longitude;
            shop.IsActive  = false;

            _repository.Create(shop);

            return(id);
        }