public async Task <ActionResult> Add(AddTodoViewModel model) { await TodoService.AddAsync(new AddTodoServiceRequest { Title = model.Title, Username = Username }); return(RedirectToAction("Index")); }
private async void ExecuteAddTodo() { try { _logger.Log($"Add new todo: {NewTaskText}"); await _todoService.AddAsync(new Todo(Guid.NewGuid(), NewTaskText)); await LoadTodosAsync(); NewTaskText = string.Empty; } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public async Task<ActionResult> Post(AddTodo command) { await _todoService.AddAsync(command); return Created("api/todoes", command.Id); // return CreatedAtAction(nameof(Get), new { todoId = command.Id }); }