Beispiel #1
0
        public void RemoveCity(CityModel model)
        {
            bt_City City = gWork.Repository <bt_City>().AsQuerable().FirstOrDefault(x => x.CityId == model.CityId);

            gWork.Repository <bt_City>().Attach(City);
            City.IsDeleted = true;
            gWork.SaveChanges();
        }
Beispiel #2
0
        public void UpdateCity(CityModel model)
        {
            bt_City City = gWork.Repository <bt_City>().AsQuerable().FirstOrDefault(x => x.CityId == model.CityId);

            gWork.Repository <bt_City>().Attach(City);
            City.CityId     = model.CityId;
            City.Name       = model.Name;
            City.Code       = model.Code;
            City.DistrictId = model.DistrictId;
            gWork.SaveChanges();
        }
Beispiel #3
0
        public void AddCity(CityModel model)
        {
            bt_City city = new bt_City();

            city.CityId     = model.CityId;
            city.Name       = model.Name;
            city.Code       = model.Code;
            city.DistrictId = model.DistrictId;
            city.StateId    = model.StateId;
            city.CountryId  = model.CountryId;
            city.IsActive   = model.IsActive;
            gWork.Repository <bt_City>().Add(city);
            gWork.SaveChanges();
        }