Пример #1
0
        public virtual async Task <XOFFOperationResult> GetAll()
        {
            try
            {
                var getResult = await _getter.Get();

                if (!getResult.Success)
                {
                    return(XOFFOperationResult.CreateFailure(getResult.Message));
                }
                if (getResult.Result != null)
                {
                    var upsertResult = _repository.ReplaceAll(getResult.Result);
                    if (!upsertResult.Success)
                    {
                        return(XOFFOperationResult.CreateFailure(upsertResult.Exception));
                    }
                }
                return(XOFFOperationResult.CreateSuccessResult());
            }
            catch (Exception ex)
            {
                return(XOFFOperationResult.CreateFailure(ex));
            }
        }
Пример #2
0
        public async Task Refresh()
        {
            if (_connectivityChecker.Connected)
            {
                var results = await _remoteEntityGetter.Get();

                if (results.Success)
                {
                    _repository.ReplaceAll(results.Result);
                }
            }
        }
Пример #3
0
        public async Task Refresh()
        {
            if (_connectivityChecker.Connected)
            {
                var results = await _remoteEntityGetter.Get();

                if (results.Success)
                {
                    _repository.DeleteAll(null, recursive: true);
                    _repository.Upsert(results.Result);
                }
            }
        }