Esempio n. 1
0
        public void RemoveCountry(Guid CountryId)
        {
            bt_Country model = gWork.Repository <bt_Country>().AsQuerable().FirstOrDefault(x => x.CountryId == CountryId);

            if (model != null)
            {
                gWork.Repository <bt_Country>().Delete(model);
            }
        }
Esempio n. 2
0
        public void AddCountry(CountryModel model)
        {
            bt_Country country = new bt_Country();

            country.CountryId = model.CountryId;
            country.Name      = model.Name;
            country.Code      = model.Code;
            gWork.Repository <bt_Country>().Add(country);
            gWork.SaveChanges();
        }
Esempio n. 3
0
        public void UpdateCountry(CountryModel model)
        {
            bt_Country country = gWork.Repository <bt_Country>().AsQuerable().FirstOrDefault(x => x.CountryId == model.CountryId);

            if (country != null)
            {
                gWork.Repository <bt_Country>().Attach(country);
                country.Name = model.Name;
                country.Code = model.Code;
                gWork.SaveChanges();
            }
        }