public async Task <IActionResult> Index() { var todoItems = await _todoItemRepository.GetAllAsync(); foreach (var todo in todoItems) { await redis.SetStringAsync($"Sample:TodoItems:{todo.Id}:Datas", JsonConvert.SerializeObject(todo), TimeSpan.FromMinutes(60)); } return(View()); }
public async Task GetAllByListIdAsync_Should_Return_All_Todo_Items_From_A_List() { // Arrange var todoItems = Builder <TodoItem> .CreateListOfSize(10).Build().ToList(); TodoItemRepository.GetAllAsync(Arg.Any <Expression <Func <TodoItem, bool> > >()).Returns(todoItems); // Act var result = await _sut.GetAllByListIdAsync(Guid.NewGuid()); // Assert result.Should().HaveCount(10); await TodoItemRepository.Received().GetAllAsync(Arg.Any <Expression <Func <TodoItem, bool> > >()); }
public async Task <ActionResult <IEnumerable <TodoItem> > > GetTodoItemsAsync() { var result = await _todoItemRepository.GetAllAsync(); return(result); }
public async Task <IActionResult> Index() { var todos = await _todoItemRepository.GetAllAsync(); return(View(todos)); }