Exemplo n.º 1
0
        /// <summary>
        /// get location info
        /// </summary>
        /// <param name="locationid">locaion id</param>
        /// <returns>location info</returns>
        public async Task <Models.Location.Location> GetLocationInforation(string locationid)
        {
            Models.Location.Location location = new Models.Location.Location();
            try
            {
                _ResponseMessage = await _HttpClient.GetAsync(_HttpClient.BaseAddress.AbsoluteUri + "locations/" + locationid + "?access_token=" + _AccessToken);

                if (_ResponseMessage.IsSuccessStatusCode)
                {
                    string responsestring = await _ResponseMessage.Content.ReadAsStringAsync();

                    location = JsonConvert.DeserializeObject <Models.Location.Location>(responsestring);
                }
                else
                {
                    location.meta.code = int.Parse(_ResponseMessage.StatusCode.ToString());
                }
                return(location);
            }
            catch (Exception ex)
            {
                if (_Telemetryclient != null)
                {
                    _Telemetryclient.TrackException(ex);
                }
                location.meta.code = int.Parse(_ResponseMessage.StatusCode.ToString());
            }
            return(location);
        }
Exemplo n.º 2
0
        public void Add(CreateLocationViewModel viewModel)
        {
            try
            {
                var location = new Models.Location.Location
                {
                    Id         = viewModel.LocationId,
                    BusinessId = viewModel.BusinessId,
                    Address    = viewModel.Address,
                    City       = viewModel.City,
                    Zip        = viewModel.Zip,
                    Country    = viewModel.Country
                                 //TODO: ADD LOCATION NAME
                };

                var headquaters = new BusinessHeadquaters
                {
                    Id   = viewModel.LocationId,
                    City = viewModel.City
                };

                Lock();

                _locationRepository.Add(location);
                _businessRepository.AddHeadquaters(headquaters, location.BusinessId);
            }
            catch (Exception)
            {
                //TODO: Rollback logic
                throw new Exception("Failed to perform atomic action - " + Desc);
            }
            finally
            {
                Unlock();
            }
        }
Exemplo n.º 3
0
        public async Task UpdateUserLocation(Models.Location.Location newLocReq, string token)
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayMarketingEndpoint, ApiUrlBase);

            await _requestProvider.PostAsync(uri, newLocReq, token);
        }
Exemplo n.º 4
0
 public Task UpdateUserLocation(Models.Location.Location newLocReq, string token)
 {
     throw new NotImplementedException();
 }