public async Task <bool> Create(TodoItem todoItem) { var repo = new TodoItemRepository(); var rows = await repo.Create(todoItem); return(rows == 1); }
public async Task Create_Should_CallCreate() { // Arrange var item = new TodoItem(); _repositoryMock .Setup(x => x.Create(It.IsAny <TodoItem>())) .Returns(Task.CompletedTask); // Act await _repository.Create(item); // Assert _repositoryMock.Verify(x => x.Create(item), Times.Once()); _repositoryMock.VerifyNoOtherCalls(); }
public TodoItemGetViewModel Create(TodoItemCreateViewModel value) { TodoItem item = new TodoItem { Content = value.Content, CreatedAt = DateTime.Now }; var model = _repo.Create(item); var result = new TodoItemGetViewModel { Id = model.Id, Content = model.Content, IsCompleted = model.IsCompleted, CreatedAt = model.CreatedAt }; return(result); }
public async void SaveTodoItemButton_Click() { if (TodoItems.Any(t => t.Id == TodoItem.Id)) { await ManageAppointment(); await TodoItemRepository.Update(TodoItem); } else { await ManageAppointment(); await TodoItemRepository.Create(TodoItem); } if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }