コード例 #1
0
ファイル: GeoRepository.cs プロジェクト: okusnadi/cloudscribe
        /// <summary>
        /// Persists a new instance of GeoZone.
        /// </summary>
        /// <returns></returns>
        public async Task <bool> Save(IGeoZone geoZone)
        {
            if (geoZone == null)
            {
                return(false);
            }
            bool result = false;

            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);
        }
コード例 #2
0
        /// <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 = false;

            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);
        }
コード例 #3
0
ファイル: GeoRepository.cs プロジェクト: itsurge/cloudscribe
        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);
        }