Exemplo n.º 1
0
        // GET: glossary
        public async Task <IActionResult> Index(int?id)
        {
            int pagenumber = 1;

            if (id != null)
            {
                pagenumber = (int)id;
            }

            /* List Initialization */
            var ListEntity = new GlossaryListView()
            {
                isListStatus = false,
                QueryOptions = new WikiEntity()
                {
                    pagenumber = (int)pagenumber,
                    term       = "",
                    iscache    = true,
                    pagesize   = 20,
                    order      = "term asc",
                },
                DefaultUrl        = Config.GetUrl("glossary/"),
                PaginationUrl     = Config.GetUrl("glossary/Index/[p]/"),
                NoRecordFoundText = SiteConfig.generalLocalizer["_no_records"].Value,
            };

            if (HttpContext.Request.Query["cq"].Count > 0)
            {
                ListEntity.Character = HttpContext.Request.Query["cq"].ToString();
            }
            if (HttpContext.Request.Query["query"].Count > 0)
            {
                ListEntity.QueryOptions.term = HttpContext.Request.Query["query"].ToString();
            }

            ListEntity.TotalRecords = await WikiBLLC.Count(_context, ListEntity.QueryOptions);

            if (ListEntity.TotalRecords > 0)
            {
                ListEntity.DataList = await WikiBLLC.LoadItems(_context, ListEntity.QueryOptions);
            }

            if (ListEntity.Character != "" && ListEntity.Character != null)
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["_wiki_posts_filter_character"].Value + " " + ListEntity.Character.ToUpper();
            }
            else if (ListEntity.QueryOptions.term != "" && ListEntity.QueryOptions.term != null)
            {
                ViewBag.title = ListEntity.QueryOptions.term + " | " + SiteConfig.dictionaryLocalizer["_wiki_posts"].Value;
            }
            else
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["_wiki_posts"].Value;
            }

            return(View(ListEntity));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> term(string term, int?id)
        {
            int pagenumber = 1;

            if (id != null)
            {
                pagenumber = (int)id;
            }

            var _sanitize = new HtmlSanitizer();

            term = _sanitize.Sanitize(UtilityBLL.ReplaceHyphinWithSpace(term));
            /* List Initialization */
            var ListEntity = new GlossaryListView()
            {
                isListStatus = false,
                QueryOptions = new WikiEntity()
                {
                    pagenumber = (int)pagenumber,
                    term       = term,
                    iscache    = false,
                    pagesize   = 20,
                    order      = "id desc",
                },
                ListObject = new Jugnoon.Scripts.ListItems()
                {
                    ListType = Jugnoon.Scripts.ListType.List, // 0: grid 1: list
                },
                DefaultUrl        = Config.GetUrl("glosarry/term/" + term),
                PaginationUrl     = Config.GetUrl("glossary/term/" + term + "/[p]/"),
                NoRecordFoundText = SiteConfig.generalLocalizer["_no_records"].Value,
            };

            if (HttpContext.Request.Query["query"].Count > 0)
            {
                ListEntity.QueryOptions.term = HttpContext.Request.Query["query"].ToString();
            }

            ListEntity.TotalRecords = await WikiBLLC.Count(_context, ListEntity.QueryOptions);

            if (ListEntity.TotalRecords > 0)
            {
                ListEntity.DataList = await WikiBLLC.LoadItems(_context, ListEntity.QueryOptions);
            }
            if (ListEntity.Character != "" && ListEntity.Character != null)
            {
                ViewBag.title       = SiteConfig.dictionaryLocalizer["glossary_character_title"].ToString().Replace("{CN}", ListEntity.Character.ToLower());
                ViewBag.description = SiteConfig.dictionaryLocalizer["glossary_character_meta"].ToString().Replace("{CN}", ListEntity.Character.ToLower());
            }
            else if (ListEntity.QueryOptions.term != "" && ListEntity.QueryOptions.term != null)
            {
                ViewBag.title = SiteConfig.dictionaryLocalizer["glossary_query_title"].ToString().Replace("{CN}", ListEntity.QueryOptions.term.ToLower());
            }
            else
            {
                ViewBag.title       = SiteConfig.dictionaryLocalizer["glossary_home_title"];
                ViewBag.description = SiteConfig.dictionaryLocalizer["glossary_home_meta"];
            }

            return(View(ListEntity));
        }