Example #1
0
        /// <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);
        }
Example #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);
        }
Example #3
0
        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);
        }