/// <summary> /// Persists a new instance of GeoZone. /// </summary> /// <returns></returns> public async Task <bool> Save(IGeoZone geoZone) { if (geoZone == null) { return(false); } bool result; if (geoZone.Guid == Guid.Empty) { geoZone.Guid = Guid.NewGuid(); result = dbGeoZone.Create( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } else { result = dbGeoZone.Update( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } return(result); }
/// <summary> /// Persists a new instance of GeoZone. /// </summary> /// <returns></returns> public async Task <bool> Save(IGeoZone geoZone, CancellationToken cancellationToken = default(CancellationToken)) { if (geoZone == null) { return(false); } cancellationToken.ThrowIfCancellationRequested(); bool result; if (geoZone.Guid == Guid.Empty) { geoZone.Guid = Guid.NewGuid(); result = dbGeoZone.Create( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } else { result = dbGeoZone.Update( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } return(result); }