public PartialViewResult _GetPosts(int?category_id, int user_id, bool publish) { List <PostModel> list = new List <PostModel>(); list = _postM.GetAllPost(category_id, user_id, publish); return(PartialView(list)); }
public ActionResult Index() { PostManager mgr = new PostManager(); HomeIndexVM model = new HomeIndexVM(); var allPosts = mgr.GetAllPost(); List <ViewPostVM> list = new List <ViewPostVM>(); foreach (var p in allPosts) { ViewPostVM post = new ViewPostVM() { PostTitle = p.PostTitle, PostBody = p.PostBody, PostId = p.Id, PostCategory = p.PostCategory, PostedDate = p.PostedDate, PostImageFileName = p.PostImageFileName, PostTags = p.PostTags }; list.Add(post); } model.Posts = list; return(View(model)); }
public void GetAllPosts_Performs_Expected_Work() { SetUp(); var expected = sut.GetAllPost(); Assert.That(expected, Is.Not.Null); }
//[Authorize(Roles = "Admin")] public ActionResult ViewSubmissions() { var mgr = new PostManager(); var response = mgr.GetAllPost(); List <Post> model = new List <Post>(); foreach (var p in response) { if (p.PostState == PostState.Pending) { model.Add(p); } } return(View(model)); }
//[Authorize(Roles = "Marketing")] public ActionResult ViewSubmissions() { var mgr = new PostManager(); List <Post> model = new List <Post>(); var response = mgr.GetAllPost(); foreach (var p in response) { if (p.Username == User.Identity.Name) { model.Add(p); } } return(View(model)); }
public ActionResult Search(string searchName, string layout) { var user = Session["User"] as User; ViewBag.currentUser = user.Id; if (searchName == null) { return(SearchView(layout)); } var listOfPost = postManager.GetAllPost(user.Id); ViewBag.PostList = listOfPost; var profileList = profileManager.GetProfilesByName(searchName); ViewBag.Search = profileList; var view = SearchView(layout); return(view); }
private void LoadPostGridView() { showPostGridView.DataSource = postManager.GetAllPost(); showPostGridView.DataBind(); }