コード例 #1
0
        public async Task <ActionResult <IEnumerable <Blog> > > GetMyBlogs()
        {
            // TODO[epic=Auth] Replaces req.userinfo
            // IF YOU EVER NEED THE ACTIVE USERS INFO THIS IS HOW YOU DO IT (FROM AUTH0)
            Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

            IEnumerable <Blog> blogs = _bservice.GetBlogsByCreatorId(userInfo.Id);

            return(Ok(blogs));
        }
コード例 #2
0
 public ActionResult <IEnumerable <Blog> > GetBlogsByProfileId(string id)
 {
     try
     {
         IEnumerable <Blog> blogs = _blogService.GetBlogsByCreatorId(id);
         return(Ok(blogs));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #3
0
        public async Task <ActionResult <IEnumerable <Blog> > > GetBlogsByCreatorId()
        {
            try
            {
                Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

                Account            currentUser = _service.GetOrCreateAccount(userInfo);
                IEnumerable <Blog> blogs       = _blogService.GetBlogsByCreatorId(currentUser.Id);
                return(Ok(blogs));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }