Ejemplo n.º 1
0
        public void ActionDetail(string tagCode)
        {
            MTagModel model = new MTagModel();

            TryUpdateModel(model);

            ModTagEntity _Tag = ModTagService.Instance.GetByCode(tagCode);

            if (_Tag != null)
            {
                var dbQuery = ModNewsService.Instance.CreateQuery()
                              .Where(o => o.Activity == true)
                              .WhereIn(o => o.ID, ModNewsTagService.Instance.CreateQuery()
                                       .Select(o => o.NewsID)
                                       .Where(o => o.TagID == _Tag.ID)
                                       )
                              .OrderByDesc(o => o.ID)
                              .Take(PageSize)
                              .Skip(PageSize * model.Page);

                ViewBag.Data      = dbQuery.ToList();
                model.TotalRecord = dbQuery.TotalRecord;
            }
            else
            {
                ViewPage.Response.Redirect("~/");
                return;
            }

            ViewBag.Model = model;
            ViewBag.Tag   = _Tag;
        }
Ejemplo n.º 2
0
        public void ActionDetail(string tagCode)
        {
            MTagModel model = new MTagModel();

            TryUpdateModel(model);

            ModTagEntity _Tag = ModTagService.Instance.GetByCode(tagCode);

            if (_Tag != null)
            {
                var dbQuery = ModNewsService.Instance.CreateQuery()
                                    .Where(o => o.Activity == true)
                                    .WhereIn(o => o.ID, ModNewsTagService.Instance.CreateQuery()
                                                            .Select(o => o.NewsID)
                                                            .Where(o => o.TagID == _Tag.ID)
                                            )
                                    .OrderByDesc(o => o.ID)
                                    .Take(PageSize)
                                    .Skip(PageSize * model.Page);

                ViewBag.Data = dbQuery.ToList();
                model.TotalRecord = dbQuery.TotalRecord;
            }
            else
            {
                ViewPage.Response.Redirect("~/");
                return;
            }

            ViewBag.Model = model;
            ViewBag.Tag = _Tag;
        }