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)); }
public ActionResult <IEnumerable <Blog> > GetBlogsByProfileId(string id) { try { IEnumerable <Blog> blogs = _blogService.GetBlogsByCreatorId(id); return(Ok(blogs)); } catch (Exception e) { return(BadRequest(e.Message)); } }
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)); } }