コード例 #1
0
        public async Task <IActionResult> Index(
            string type     = "",
            int pageNumber  = 1,
            int pageSize    = -1,
            string sort     = "desc",
            string title    = "",
            int tagId       = 0,
            string isPublic = "true"
            )
        {
            if (pageNumber <= 0)
            {
                pageNumber = 1;
            }

            if (type == "1")
            {
                ViewBag.BreadCrump = "لیست پادکست ها";
            }
            var itemsPerPage = 10;

            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }

            bool?ispub = null;

            if (isPublic != "-1")
            {
                ispub = Convert.ToBoolean(isPublic);
            }

            var model = await _podcastService.GetPagedPodcastAsync(
                pageNumber, itemsPerPage, sort == "desc"?SortOrder.Descending : SortOrder.Ascending, type, ispub, title, tagId).ConfigureAwait(false);

            model.Type = type;
            model.Paging.CurrentPage = pageNumber;
            model.Title = title;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.TagId    = tagId.ToString();
            model.IsPublic = isPublic;
            return(View(model));
        }