Beispiel #1
0
        public TodoListDTO Update(int id, TodoListDTO todoListDTO)
        {
            var todoList = _todoListService.Get(id);

            todoList.UpdateData(todoListDTO.Name, todoListDTO.Done, _categoryService.Get(todoListDTO.Category.Id));
            return(_todoListMapper.MapperToDTO(_todoListService.Update(todoList)));
        }
        public TaskDTO Add(TaskDTO taskDTO)
        {
            var task = _taskMapper.MapperToEntity(taskDTO);

            task.SetTodoList(_todoListService.Get(taskDTO.TodoList.Id));
            task.SetUser(_userService.Get(taskDTO.User.Id));
            return(_taskMapper.MapperToDTO(_taskService.Add(task)));
        }
Beispiel #3
0
        public ActionResult <TodoListVm> GetById(int userId, int todoListId)
        {
            var todoList = _todoListService.Get(userId, todoListId);

            if (todoList == null)
            {
                return(NotFound());
            }

            return(_mapper.Map <TodoListVm>(todoList));
        }
Beispiel #4
0
        public ActionResult <List <TodoItemVm> > GetAll(int userId, int todoListId)
        {
            var todoList = _todoListService.Get(userId, todoListId);

            if (todoList == null)
            {
                return(NotFound());
            }

            return(_mapper.Map <List <TodoItemVm> >(todoList.TodoItems));
        }
Beispiel #5
0
 /// <summary>
 /// retrives collection of todo-lists
 /// </summary>
 /// <returns>collection of todo-lists</returns>
 public IHttpActionResult Get()
 {
     try
     {
         return(Ok(_todoListsService.Get()));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public ActionResult <ApiResult <TodoListItem> > GetById(Guid id)
        {
            var result = new ApiResult <TodoListItem>();

            result.Data = _todoListService.Get(id);
            if (result.Data == null)
            {
                result.Message = "No Todo find with that Id";
                return(NoContent());
            }

            result.Message = "Todo Info";

            return(result);
        }
Beispiel #7
0
 public IEnumerable <TodoListItem> Get()
 {
     return(todoListService.Get());
 }
Beispiel #8
0
 public Task <IEnumerable <ToDoViewModel> > Get()
 {
     return(_todoListService.Get());
 }