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); } }
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(); }
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(); } }