private void ButtonAddItem_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(Description.Text) || string.IsNullOrEmpty(Name.Text) || string.IsNullOrEmpty(DeadLine.Text)) { MessageBox.Show(Messages.MissingInfo, "Fail", MessageBoxButton.OK, MessageBoxImage.Error); return; } var result = _itemRepository.AddNewItem(new Item { DeadLine = DateTime.Parse(DeadLine.Text), Description = Description.Text, Name = Name.Text, Status = Status.IsChecked.Value, ToDoListId = _toDoId }); if (result) { DialogResult = true; MessageBox.Show(Messages.NewListItemAdded, "Success", MessageBoxButton.OK, MessageBoxImage.Information); Close(); } else { MessageBox.Show(Messages.SomethingWrong, "Fail", MessageBoxButton.OK, MessageBoxImage.Error); DialogResult = false; } }
public async Task <ActionResult <ReqResult> > CreateNewItem([FromBody] ItemDTO newItem) { var addItemResult = await _repository.AddNewItem(newItem); if (addItemResult == ReqResult.Success) { return(StatusCode(201)); } else { return(StatusCode(500)); } }