Ejemplo n.º 1
0
        public async Task <bool> UpdateGeodata(ClaimsPrincipal userClaims, GeolocationDto geolocation)
        {
            var user = await _userManager.GetUserAsync(userClaims);

            if (user == null)
            {
                return(false);
            }

            _profileRepo.LoadProfileWithGeo(user);


            user.Profile.LastGeolocation.Latitude  = user.Profile.Geolocation.Latitude;
            user.Profile.LastGeolocation.Longitude = user.Profile.Geolocation.Longitude;

            user.Profile.Geolocation.Latitude  = geolocation.Latitude;
            user.Profile.Geolocation.Longitude = geolocation.Longitude;

            _geoRepo.Update(user.Profile.Geolocation);
            _lastGeoRepo.Update(user.Profile.LastGeolocation);

            _geolocationHistoryRepo.AddGeolocationHistoryRecord(user.Profile, geolocation);

            _logger.LogCritical($"Before commit: {geolocation.Longitude} : {geolocation.Latitude}");
            if (!_uow.Commit())
            {
                return(false);
            }

            ApplyGeolocationToAllFriends(user);
            return(true);
        }
Ejemplo n.º 2
0
 public Task <bool> Update(IGeoCountry geoCountry)
 {
     return(repo.Update(geoCountry, CancellationToken.None));
 }