Exemplo n.º 1
0
        public ViewResult MyPost(
            int id   = 1,
            int page = 1,
            int row  = 20)
        {
            var areaDb   = new AreaDb();
            var listArea = areaDb.GetAll();

            ViewBag.listArea = listArea;
            var listAreaChild = areaDb.GetListAreaById(1);

            ViewBag.listAreaChild = listAreaChild;

            var menuListModel = new MenuListModels();

            if (Session["ListOfMyPost"] != null)
            {
                menuListModel = (MenuListModels)Session["ListOfMyPost"];
            }

            var newsDb = new NewsDb();
            int intCount;

            id = new UserDb().GetUserInfo(User.Identity.Name).Id;
            menuListModel.newsModel = newsDb.SearchMyPost(out intCount, menuListModel.TinhThanhId, menuListModel.QuanHuyenId, menuListModel.Title, menuListModel.Price, page, row, id);
            ViewBag.NumberOfPages   = intCount / row + (intCount % row > 0 ? 1 : 0);
            ViewBag.CurrentPage     = page;
            return(View(menuListModel));
        }
Exemplo n.º 2
0
        public ViewResult ShowPost(
            int id   = 1,
            int page = 1,
            int row  = 20
            )
        {
            var areaDb   = new AreaDb();
            var listArea = areaDb.GetAll();

            ViewBag.listArea = listArea;
            var listAreaChild = areaDb.GetListAreaById(1);

            ViewBag.listAreaChild = listAreaChild;

            var menuListModel = new MenuListModels();

            if (Session["ListOfPost"] != null)
            {
                menuListModel = (MenuListModels)Session["ListOfPost"];
            }

            var newsDb = new NewsDb();
            var menuDb = new MenuDb();
            int intCount;

            menuListModel.MenuId    = id;
            menuListModel.MenuName  = menuDb.GetMenuById(id).Name;
            menuListModel.newsModel = newsDb.SearchNews(out intCount, menuListModel.TinhThanhId, menuListModel.QuanHuyenId, menuListModel.Title, menuListModel.Price, page, row, id);

            ViewBag.NumberOfPages = intCount / row + (intCount % row > 0 ? 1 : 0);
            ViewBag.CurrentPage   = page;
            ViewBag.MenuId        = id;
            return(View(menuListModel));
        }
Exemplo n.º 3
0
 public RedirectToRouteResult MyPost(MenuListModels model)
 {
     Session["ListOfMyPost"] = model;
     return(RedirectToAction("MyPost", new { @id = model.MenuId }));
 }