Exemple #1
0
        public PartialViewResult CreatePost(FormCollection form)
        {
            PostsModels post = new PostsModels();

            post.Message    = form["NewPost"];
            post.PostUserId = PostHelper.GetUserId(HttpContext.User.Identity.Name);

            post.CreatePost();

            List <PostsModels> lstPost = PostHelper.GetPostPage(0, 10);

            return(PartialView("Posts", lstPost));
        }
Exemple #2
0
        /// <summary>
        /// Get Post View result
        /// </summary>
        /// <param name="page">page number</param>
        /// <param name="size">size of the page to returl, default = 10</param>
        /// <returns></returns>
        public PartialViewResult Posts(int?page, int?size)
        {
            List <PostsModels> lstPost = new List <PostsModels>();

            try
            {
                lstPost = PostHelper.GetPostPage(page, size);
            }
            catch
            {
                RedirectToAction("Error");
            }
            return(PartialView(lstPost));
        }