public void CreateToDoItem(string itemName, string itemDescription, DateTime itemDeadline) { ToDoItemRepository toDoItemRepository = new ToDoItemRepository(); ToDoItem newItem = new ToDoItem(); newItem.itemDeadline = itemDeadline; newItem.itemDescription = itemDescription; newItem.itemName = itemName; newItem.itemStatus = Status.NotCompleted.ToString(); newItem.listId = selectedList.listId; toDoItemRepository.Insert(newItem); }
public async Task <ToDoItemViewModel> Handle(CreateToDoItemCommand request, CancellationToken cancellationToken) { var toDoList = await _toDoListRepository.Get(request.ToDoListId); if (toDoList == null) { throw new NotFoundException(request.ToDoListId, typeof(ToDoList)); } ToDoItem toDoItem = (ToDoItem)request; var createResponse = await ToDoItemRepository.Insert(toDoItem); var viewModel = new ToDoItemViewModel(createResponse); return(viewModel); }
public ToDoItem CreateToDoItem([FromBody] ToDoItem toDoItem) { return(_toDoItemRepository.Insert(toDoItem)); }