public IActionResult Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = FunctionConstants.GetItemsOfTodoListFunction + "{listId}")] HttpRequest req, string listId) { var user = _authService.GetClientPrincipalFromRequest(req); if (!_todoListService.CanUserAccessList(user, listId)) { return(new UnauthorizedResult()); } if (string.IsNullOrEmpty(listId)) { return(new BadRequestErrorMessageResult("Id cannot be empty")); } var todoList = _todoItemService.GetAllForListId(listId); return(new OkObjectResult(_mapper.Map <IEnumerable <TodoItemDto> >(todoList))); }