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)); } }
public async Task Refresh() { if (_connectivityChecker.Connected) { var results = await _remoteEntityGetter.Get(); if (results.Success) { _repository.ReplaceAll(results.Result); } } }
public async Task Refresh() { if (_connectivityChecker.Connected) { var results = await _remoteEntityGetter.Get(); if (results.Success) { _repository.DeleteAll(null, recursive: true); _repository.Upsert(results.Result); } } }