public void InsertCity(Domain.Labor.City city)
 {
     using (var dbContextScope = _dbContextScopeFactory.Create())
     {
         _cityRepository.Add(city);
         dbContextScope.SaveChanges();
     }
 }
        public Domain.Labor.City GetCityById(int cityId)
        {
            using (var dbContextScope = _dbContextScopeFactory.CreateReadOnly())
            {
                Domain.Labor.City city = _cityRepository.GetById(cityId);

                if (city == null)
                {
                    throw new ArgumentException($"Invalid value provided for {nameof(cityId)}: [{cityId}]. Couldn't find a user with this ID.");
                }

                return(city);
            }
        }
        public void UpdateCity(Domain.Labor.City city)
        {
            using (var dbContextScope = _dbContextScopeFactory.Create())
            {
                var dbContext = dbContextScope.DbContexts.Get <LaborObjectContext>("LaborEntites");
                Domain.Labor.City cityToUpdate = _cityRepository.GetById(city.Id);
                if (cityToUpdate == null)
                {
                    throw new ArgumentException($"Invalid {nameof(cityToUpdate)} provided: {0}. Couldn't find a User with this ID.");
                }

                // Simulate the calculation of a credit score taking some time
                cityToUpdate.Name = city.Name;
                dbContextScope.SaveChanges();
            }
        }