public IEnumerable <TodoListViewModel> GetTodoLists()
        {
            var enumerable = _todoListService.GetAllTodoLists();

            return(enumerable.Where(x => x.ApplicationUserEntityId == User.Identity.GetUserId()).Select(
                       list =>
                       new TodoListViewModel()
            {
                ApplicationUserEntityId = list.ApplicationUserEntityId,
                Id = list.Id,
                Name = list.Name
            }));
        }
Esempio n. 2
0
        public IActionResult GetUserTodoList([FromHeader] int userID, [FromQuery] int?priority, [FromQuery] bool completed)
        {
            IActionResult result = null;

            try
            {
                var todos = todoListService.GetAllTodoLists(userID, priority, completed);
                result = Ok(todos);
            }
            catch (Exception e)
            {
                //Log
                result = BadRequest(e);
            }

            return(result);
        }
Esempio n. 3
0
 /*
  * GET
  * api/todolist
  */
 public IEnumerable <TodoList> Index()
 {
     return(_service.GetAllTodoLists());
 }
Esempio n. 4
0
 public async Task <IActionResult> GetTodoLists(long projectId)
 {
     return(Ok(await _todoService.GetAllTodoLists(projectId)));
 }