예제 #1
0
        public async Task UpdateAsyncUow(Country country)
        {
            if (!IsValidEntity(country.ValidadeCountry()))
            {
                return;
            }

            if (country.States.Any())
            {
                if (country.States.Any(s => !IsValidEntity(s.ValidateState())))
                {
                    return;
                }
                try
                {
                    foreach (var state in country.States)
                    {
                        _repositoryState.Update(state);
                    }
                }
                catch (Exception)
                {
                    Notify("Falha ao alterar o estado.");
                    return;
                }
            }

            try
            {
                Update(country);
                await _unitOfWork.CommitAsync();
            }
            catch (Exception ex)
            {
                Notify("Falha ao alterar o país.");
            }
        }
예제 #2
0
 public void Update(State state)
 {
     _repositoryState.Update(state);
 }