public string UpdatePool(PoolEntity pe) { var countryId = DataContext.CMS_POOLs.Single(d => d.cms_pool_id == pe.Id).COUNTRy1.CountryId; var poolAlreadyExistsInCountry = PoolEntityCheck.DoesPoolNameExistForCountry(DataContext, pe.PoolName, countryId, pe.Id); if (poolAlreadyExistsInCountry) { return(PoolEntityCheck.PoolAlreadyExistsForCountry); } var poolDbEntry = DataContext.CMS_POOLs.Single(d => d.cms_pool_id == pe.Id); poolDbEntry.cms_pool1 = pe.PoolName; poolDbEntry.IsActive = pe.Active; var returned = SubmitDbChanges(); return(returned); }
public string CreateNewPool(PoolEntity pe) { var poolAlreadyExistsInCountry = PoolEntityCheck.DoesPoolNameExistForCountry(DataContext, pe.PoolName, pe.CountryId); if (poolAlreadyExistsInCountry) { return(PoolEntityCheck.PoolAlreadyExistsForCountry); } var countryCode = DataContext.COUNTRies.Single(d => d.CountryId == pe.CountryId).country1; var newPoolEnitiy = new CMS_POOL { IsActive = true, cms_pool1 = pe.PoolName, country = countryCode, }; DataContext.CMS_POOLs.InsertOnSubmit(newPoolEnitiy); var returned = SubmitDbChanges(); return(returned); }