public async Task <IEnumerable <Restore> > GetAllRestorsAsync(Guid connectionId) { return(await Task.Run(() => { var connection = GetConnection(connectionId); using (var api = new RestoreAPIRedirectService(connection.ServiceAddress)) { var result = api.GetAllRestorsAsync().Result; if (result == null) { throw new NullReferenceException(); } return result.Select(r => { var login = ""; var client = _clientRepository.GetById(r.ClientId); if (client != null) { login = client.Login; } var status = Enum.GetName(typeof(RestoreStatus), r.Status); return new Restore(r.RestoreId, r.BackupId, r.Date, r.ExecutedDate, login, status); }); } })); }
public async Task <RestoreStatus> RestoreAsync(Guid connectionId, RestoreParamsDTO restore) { return(await Task.Run(() => { var connection = GetConnection(connectionId); using (var api = new RestoreAPIRedirectService(connection.ServiceAddress)) { return api.RestoreAsync(restore); } })); }
public async Task DeleteAsync(Guid connectionId, int restoreId) { await Task.Run(() => { var connection = GetConnection(connectionId); using (var api = new RestoreAPIRedirectService(connection.ServiceAddress)) { return(api.DeleteAsync(restoreId)); } }); }