/// <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 = await dbGeoZone.Create( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } else { result = await 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 = await dbGeoZone.Create( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } else { result = await dbGeoZone.Update( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code); } return(result); }
public async Task <bool> Update( IGeoZone geoZone, CancellationToken cancellationToken = default(CancellationToken)) { if (geoZone == null) { return(false); } cancellationToken.ThrowIfCancellationRequested(); bool result = await dbGeoZone.Update( geoZone.Guid, geoZone.CountryGuid, geoZone.Name, geoZone.Code, cancellationToken); return(result); }