Exemple #1
0
        public async Task <IActionResult> GetVocabularyAsync(
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetVocabularyDTO
            {
                Filter         = filter ?? "",
                MaxResultCount = AppTheme.Limit,
                SkipCount      = (p.Value - 1) * AppTheme.Limit,
                IsMustConfirm  = false
            };
            var Containers = await _VocabularyService.GetContributedListAsync(serchInp);

            string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                           Containers.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + Containers.Items.Count, Containers.TotalCount);

            if (!filter.IsNullOrEmpty())
            {
                listRes += string.Format(" for \"{0}\"", serchInp.Filter);
            }
            ViewBag.ListState = listRes;

            ViewBag.Filter     = filter;
            ViewBag.Pagination = PaginateHelper.Generate(
                "javascript:syncVt('{0}', '" + filter + "');",
                p.Value, Containers.TotalCount, AppTheme.Limit);
            return(PartialView("~/Pages/Dictionary/VocabContributes/Partials/Vocabularies.cshtml", Containers));
        }
Exemple #2
0
        public async Task <IActionResult> GetAsync(
            [FromQuery] Guid?topicId,
            [FromQuery] Guid?wcId,
            [FromQuery] int?p         = 1,
            [FromQuery] string filter = "")
        {
            if (p == null || p <= 0)
            {
                p = 1;
            }
            ViewBag.p = p.Value;

            var serchInp = new GetVocabularyDTO
            {
                Filter            = filter ?? "",
                MaxResultCount    = AppTheme.Limit,
                SkipCount         = (p.Value - 1) * AppTheme.Limit,
                WordClassId       = wcId,
                VocabularyTopicId = topicId,
                IsMustConfirm     = false
            };
            var res = await _VocabularyService.GetListAsync(serchInp);

            if (res.Success)
            {
                PagedResultDto <VocabularyDTO> Containers = res.Data;

                string listRes = string.Format("Showing {0} to {1} of {2} entries",
                                               res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount);
                if (!filter.IsNullOrEmpty())
                {
                    listRes += string.Format(" for \"{0}\"", serchInp.Filter);
                }
                ViewBag.ListState = listRes;

                ViewBag.Filter     = filter;
                ViewBag.Pagination = PaginateHelper.Generate(
                    "javascript:syncVt('{0}', '" + filter + "');",
                    p.Value, Containers.TotalCount, AppTheme.Limit);
                return(PartialView("~/Pages/Manager/Vocabularies/Partials/Vocabularies.cshtml", Containers));
            }
            else
            {
                return(PartialView(AppTheme.ContentNothing));
            }
        }