// GET: /<controller>/ //Home/Index public async Task <IActionResult> Index(string search) { //var model = repository.GetAllPosts(); MasterOneVM model = new MasterOneVM(); //if (User.Identity.IsAuthenticated) //{ // var user = await userManager.FindByNameAsync(User.Identity.Name); // model.IsUserAdmin = await userManager.IsInRoleAsync(user, "Admin"); //} var posts = from m in dbContext.Posts select m; //Search if (!String.IsNullOrEmpty(search)) { model.BlogPosts = repository.GetSearch(search); } else { model.BlogPosts = repository.GetAllPosts(); } model.Categories = repository.GetAllCategories(); //var model = new PostListVM(); //model.Categories = repository.GetAllCategories(); //return View(model); return(View(model)); }
public async Task <List <Post> > GetPosts() { return(await _postsRepo.GetAllPosts()); }
public ViewResult SeePosts() { var model = _postsRepository.GetAllPosts(); return(View(model)); }
public IEnumerable <Post> GetAllPosts() { return(repository.GetAllPosts()); }
public ActionResult Index() { var posts = _repository.GetAllPosts(); return(View(posts)); }
public async Task <IEnumerable <Post> > GetAllPosts() { return(await _postsRepository.GetAllPosts()); }