Пример #1
0
        public int CreateCity(BusinessEntities.CityEntity cityEntity)
        {
            //using (var scope = new TransactionScope()) // TODO: Handle transction scope.
            //{
            var city = new City
            {
                CityName = cityEntity.CityName
            };

            _unitOfWork.CityRepository.Insert(city);
            _unitOfWork.Save();
            //scope.Complete();
            return(city.CityId);
            //}
        }
Пример #2
0
        public bool UpdateCity(int cityId, BusinessEntities.CityEntity cityEntity)
        {
            var success = false;

            if (cityEntity != null)
            {
                //using (var scope = new TransactionScope())// TODO: Handle transction scope.
                //{
                var city = _unitOfWork.CityRepository.GetByID(cityId);
                if (city != null)
                {
                    city.CityName = cityEntity.CityName;
                    _unitOfWork.CityRepository.Update(city);
                    _unitOfWork.Save();
                    //scope.Complete();
                    success = true;
                }
                //}
            }
            return(success);
        }