Example #1
0
        //GET /api/TodoItem
        /// <summary>
        /// Retrieves all todo items for the current user
        /// </summary>
        /// <returns></returns>
        public async Task <IHttpActionResult> Get()
        {
            /*
             * Note: when using User.Identity.GetLoginId(), make sure that the ID is the same!
             * When logging on using the cookie, the ID will be the value of the NameIdentifier claim (email address in this case).
             * When logging on using the bearer token, the ID will be the actual user ID.
             */
            var data = await TodoItemRepository.FindByUserNameAsync(User.Identity.Name);

            //Transforms each Domain.TodoItem into a Models.Output.TodoItem
            return(Ok(data.Select(Models.Output.TodoItem.Project)));
        }