Esempio n. 1
0
 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"));
 }
Esempio n. 2
0
        /*
         * 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));
        }
Esempio n. 3
0
 public bool AddTodoList([FromServices] ITodoListService todoListService, [FromBody] CreateTodoDto todo)
 {
     return(todoListService.AddTodoList(todo));
 }
Esempio n. 4
0
        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));
        }