Exemple #1
0
        public ActionResult Search(string searchString, int page = 1, int pageSize = 8)
        {
            List <Post> posts = new List <Post>();
            var         model = new List <PostViewModel>();

            //search for post in db
            if (string.IsNullOrEmpty(searchString))
            {
                posts = postDAO.GetAll(page, pageSize);
                foreach (var item in posts)
                {
                    model.Add(Mapper.Map <PostViewModel>(item));
                }
            }
            else
            {
                model = ProcessPost(postDAO.Search(searchString), searchString)
                        .Skip((page - 1) * pageSize)
                        .Take(pageSize)
                        .ToList();
            }

            ViewBag.IsAnyLeft    = IsAnyLeftInSearch(searchString, page, pageSize);
            ViewBag.SearchString = searchString;
            return(View(model));
        }
Exemple #2
0
 public PartialViewResult Footer()
 {
     ViewBag.Brand        = systemInfoDAO.GetBrand();
     ViewBag.Logo         = systemInfoDAO.GetLogo();
     ViewBag.BottomMenus  = menuDAO.GetBottomMenus();
     ViewBag.ContactInfo  = systemInfoDAO.GetContactInfo();
     ViewBag.SocialLinks  = systemInfoDAO.GetSocialLink();
     ViewBag.HotNews      = postDAO.GetAll(1, 10).Skip(0).Take(6).ToList();
     ViewBag.ContactInfo  = systemInfoDAO.GetContactInfo();
     ViewBag.Recruitments = recruitmentDAO.GetAllWithUser().Skip(0).Take(3).ToList();
     return(PartialView("Footer"));
 }