public IActionResult AddTodoList([FromBody] TodoList todoList) { int.TryParse(User.Identity.Name, out int userId); todoList.OwnerId = userId; if (_todoListService.AddTodoList(todoList)) { return(Ok(todoList)); } return(BadRequest("There is something wrong with todoList info")); }
/* * POST * api/todolist */ public IActionResult Create([FromBody] TodoList todoList) { if (todoList == null) { return(BadRequest()); } _service.AddTodoList(todoList); return(CreatedAtRoute("GetTodoList", new { id = todoList.TodoListId }, todoList)); }
public bool AddTodoList([FromServices] ITodoListService todoListService, [FromBody] CreateTodoDto todo) { return(todoListService.AddTodoList(todo)); }
public async Task <IActionResult> CreateTodoList(long projectId, [FromBody] TodoListCreateModel value) { var result = await _todoService.AddTodoList(projectId, value); return(CreatedAtAction(nameof(GetTodoList), new { projectId, id = result.Id }, result)); }