示例#1
0
        public ActionResult ShowDetails(int id)
        {
            AnnouncementWithDetails announcement = AnnouncementsContext.GetAnnouncementById(id);
            List <Review>           reviews      = ReviewContext.GetReviews(id);

            ViewBag.Comments       = reviews;
            ViewBag.IdAnnouncement = id;
            Review rev = new Review();

            ViewBag.announcement = announcement;
            rev.AnnouncementId   = id;
            return(View("ShowDetails", rev));
        }
示例#2
0
        public ActionResult Index(string id = "")
        {
            if (string.IsNullOrEmpty(id))
            {
                List <Category> categorys = CategoryContext.GetCategory();

                List <Announcement> announcements = AnnouncementsContext.GetAnnouncement();

                ViewBag.Ann = announcements;
                return(View(categorys));
            }
            List <Announcement> FiltredAnnouncements = AnnouncementsContext.GetAnnouncement().Where(a => a.CategoryName == id).ToList();
            List <Category>     FiltredCategory      = CategoryContext.GetCategory();

            ViewBag.Ann = FiltredAnnouncements;


            return(View(FiltredCategory));
        }