public static ImmutableArray<Todo> CompleteTodoReducer(ImmutableArray<Todo> previousState, CompleteTodoAction action) { var todoToEdit = previousState.First(todo => todo.Id == action.TodoId); return previousState .Replace(todoToEdit, new Todo { Id = todoToEdit.Id, Text = todoToEdit.Text, IsCompleted = !todoToEdit.IsCompleted }); }
public static ImmutableArray <Todo> CompleteTodoReducer(ImmutableArray <Todo> previousState, CompleteTodoAction action) { var todoToEdit = previousState.First(todo => todo.Id == action.TodoId); return(previousState .Replace(todoToEdit, new Todo { Id = todoToEdit.Id, Text = todoToEdit.Text, IsCompleted = !todoToEdit.IsCompleted })); }