public JsonResult GetAllCreatedPosts()
        {
            ResponseViewModel response = new ResponseViewModel();

            var userSession = HttpContext.Session.Get <LoggedInUserViewModel>(BasicConst.LOGGED_IN_USER_KEY);
            Task <ResponseList <Post> > responseRejectedPosts = postServices.GeAllCreatedPostByUserId(userSession?.Id ?? 0);

            if (responseRejectedPosts.Result.State.GetDescription() == BasicEnums.State.Error.GetDescription())
            {
                response.Code    = BasicEnums.State.Error.GetHashCode().ToString();
                response.Message = "Error getting created posts.";
                return(Json(response));
            }

            List <PostViewModel> createdPost = new List <PostViewModel>();

            if (responseRejectedPosts.Result.List != null)
            {
                createdPost = MappersFactory.PostViewModel().ListMapView(responseRejectedPosts.Result.List);
            }

            response.Data    = createdPost;
            response.Code    = BasicEnums.State.Ok.GetHashCode().ToString();
            response.Message = (createdPost.Count == 0 ? "You have no created posts." : string.Empty);

            return(Json(response));
        }
        public JsonResult GetAllWrittenPosts()
        {
            ResponseViewModel response = new ResponseViewModel();

            Task <ResponseList <Post> > responseWrittenPosts = postServices.GetAllWrittenPosts();

            if (responseWrittenPosts.Result.State.GetDescription() == BasicEnums.State.Error.GetDescription())
            {
                response.Code    = BasicEnums.State.Error.GetHashCode().ToString();
                response.Message = "Error getting written posts.";
                return(Json(response));
            }

            List <PostViewModel> writtenPost = new List <PostViewModel>();

            if (responseWrittenPosts.Result.List != null)
            {
                writtenPost = MappersFactory.PostViewModel().ListMapView(responseWrittenPosts.Result.List);
            }

            response.Data    = writtenPost;
            response.Code    = BasicEnums.State.Ok.GetHashCode().ToString();
            response.Message = (writtenPost.Count == 0 ? "No one has written a post yet." : string.Empty);

            return(Json(response));
        }