Пример #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));
        }
Пример #2
0
        public async Task <ActionResult> load()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <WikiEntity>(json);

            // disable to load complete list for admin use
            data.issummary  = false;
            data.isdropdown = false;

            var _posts = await WikiBLLC.LoadItems(_context, data);

            var _records = 0;

            if (data.id == 0)
            {
                _records = await WikiBLLC.Count(_context, data);
            }

            return(Ok(new { posts = _posts, records = _records }));
        }
Пример #3
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));
        }