Exemple #1
0
        public TodoListDTO Add(TodoListDTO todoListDTO)
        {
            var todoList = _todoListMapper.MapperToEntity(todoListDTO);

            todoList.SetCategory(_categoryService.Get(todoList.Category.Id));
            return(_todoListMapper.MapperToDTO(_todoListService.Add(todoList)));
        }
Exemple #2
0
        public ActionResult Add(int id, string title, string content, bool statu = false)
        {
            _todoList.Add(id, title, content, statu);

            // Redirect the user to the Index action (yet to be created)
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ICommandResult Add(CommandContext context)
        {
            List <TodoItem> newItems = new List <TodoItem>();

            foreach (string todoItem in context.GetParameterValues("todo"))
            {
                newItems.Add(service.Add(todoItem));
            }

            return(ShowQuery.BuildMarkdownTaskListResult(newItems));
        }
        public IActionResult CreateItem([FromBody] TodoListItem item)
        {
            var result = new ApiResult <TodoListItem>();

            var createdItem = _todoListService.Add(item);

            if (createdItem == null)
            {
                result.Message = "Bad Request";
                return(BadRequest(result));
            }

            result.Message = "Task Created Successfully";
            result.Data    = createdItem;

            return(Ok(result));
        }
Exemple #5
0
 public string Post([FromBody] string value)
 {
     return(todoListService.Add(value).ToString());
 }