Ejemplo n.º 1
0
        public virtual async Task <int> PatchAsync(Country country, CancellationToken cancellationToken)
        {
            var countryToUpdate = await _countriesRepository.GetAsync(new object[] { country.Id }, cancellationToken);

            if (!string.IsNullOrEmpty(country.IsoCode))
            {
                countryToUpdate.IsoCode = country.IsoCode;
            }
            if (!string.IsNullOrEmpty(country.Name))
            {
                countryToUpdate.Name = country.Name;
            }
            _countriesRepository.Update(countryToUpdate);
            return(await _countriesRepository.CompleteAsync(cancellationToken));
        }