public Task GetTask(int id) { Task task = null; lock (_lock) { task = _tasks.FirstOrDefault(t => t.Id == id); } return(task); }
public async Task <bool> UpdateTaskAsync(Task task) { using (var context = _unitOfWork.Create()) { try { return(await context.Attach(task).Update(task).CommitAsync().ConfigureAwait(false)); } catch (Exception ex) { _logger.Error(ex); return(false); } } }