/// <summary> /// Add /Update region /// </summary> public Region SaveRegion(Region region) { Region dbVersion = regionRepository.Find(region.RegionId); //Code Duplication Check if (regionRepository.DoesRegionCodeExist(region)) { throw new CaresException(Resources.GeographicalHierarchy.Region.RegionCodeDuplicationError); // doit } if (dbVersion != null) { UpdateRegionPropertie(region, dbVersion); regionRepository.Update(dbVersion); } else { dbVersion = new Region(); SetRegionProperties(region, dbVersion); regionRepository.Add(dbVersion); } regionRepository.SaveChanges(); // To Load the proprties return(regionRepository.LoadRegionWithDetail(dbVersion.RegionId)); }