Esempio n. 1
0
 public ActionResult <IEnumerable <Comment> > GetCommentsByProfileId(string id)
 {
     try
     {
         IEnumerable <Comment> comments = _commentService.GetCommentsByCreatorId(id);
         return(Ok(comments));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Esempio n. 2
0
        public async Task <ActionResult <IEnumerable <Comment> > > GetCommentsByCreatorId()
        {
            try
            {
                Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

                Account currentUser            = _service.GetOrCreateAccount(userInfo);
                IEnumerable <Comment> comments = _commentService.GetCommentsByCreatorId(currentUser.Id);
                return(Ok(comments));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }