예제 #1
0
        public async Task <ActionResult <JObject> > Details(string viewType, int?parentId, int?id)
        {
            string msg = string.Empty;

            switch (viewType)
            {
            default:
                if (parentId.HasValue && id.HasValue)
                {
                    Expression <Func <MixPagePage, bool> > predicate = model => model.ParentId == parentId && model.Id == id && model.Specificulture == _lang;
                    var portalResult = await base.GetSingleAsync <ReadViewModel>($"{viewType}_{parentId}_{id}", predicate);

                    if (portalResult.IsSucceed)
                    {
                        portalResult.Data.Page.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { action = "post", culture = _lang, portalResult.Data.Page.SeoName }, Request, Url);
                    }

                    return(Ok(JObject.FromObject(portalResult)));
                }
                else
                {
                    var model = new MixPagePage()
                    {
                        Specificulture = _lang,
                        Status         = MixService.GetConfig <int>("DefaultStatus"),
                        Priority       = ReadViewModel.Repository.Max(a => a.Priority).Data + 1
                    };

                    RepositoryResponse <ReadViewModel> result = await base.GetSingleAsync <ReadViewModel>($"{viewType}_default", null, model);

                    return(Ok(JObject.FromObject(result)));
                }
            }
        }
예제 #2
0
        public async Task <RepositoryResponse <PaginationModel <UserInfoViewModel> > > GetList(RequestPaging request)
        {
            Expression <Func <AspNetUsers, bool> > predicate = model =>
                                                               (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                                (
                                                                    (EF.Functions.Like(model.UserName, $"%{request.Keyword}%")) ||
                                                                    (EF.Functions.Like(model.FirstName, $"%{request.Keyword}%")) ||
                                                                    (EF.Functions.Like(model.LastName, $"%{request.Keyword}%"))
                                                                )
                                                               ) &&
                                                               (!request.FromDate.HasValue ||
                                                                (model.JoinDate >= request.FromDate.Value.ToUniversalTime())
                                                               ) &&
                                                               (!request.ToDate.HasValue ||
                                                                (model.JoinDate <= request.ToDate.Value.ToUniversalTime())
                                                               );

            var data = await UserInfoViewModel.Repository.GetModelListByAsync(
                predicate, request.OrderBy, request.Direction, request.PageSize, request.PageIndex)
                       .ConfigureAwait(false);

            if (data.IsSucceed)
            {
                data.Data.Items.ForEach(a =>
                {
                    a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                        new { action = "profile", a.Id }, Request, Url);
                }
                                        );
            }
            return(data);
        }
예제 #3
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  query    = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isModule = int.TryParse(query.Get("module_id"), out int moduleId);
            bool isPost   = int.TryParse(query.Get("post_id"), out int postId);

            ParseRequestPagingDate(request);
            Expression <Func <MixModulePost, bool> > predicate = model =>
                                                                 model.Specificulture == _lang &&
                                                                 (!isModule || model.ModuleId == moduleId) &&
                                                                 (!isPost || model.PostId == postId) &&
                                                                 (string.IsNullOrEmpty(request.Status) || model.Status == request.Status) &&
                                                                 (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                                  (model.Description.Contains(request.Keyword)
                                                                  ))
            ;
            string key = $"{request.Key}_{request.Query}_{request.PageSize}_{request.PageIndex}";

            switch (request.Key)
            {
            default:

                var listItemResult = await base.GetListAsync <ReadViewModel>(request, predicate);

                listItemResult.Data.Items.ForEach(n => n.Post.DetailsUrl = MixCmsHelper.GetRouterUrl(
                                                      new { action = "post", culture = _lang, id = n.Post.Id, seoName = n.Post.SeoName }, Request, Url));
                return(JObject.FromObject(listItemResult));
            }
        }
예제 #4
0
        public async Task <ActionResult <JObject> > Details(string viewType, int?id)
        {
            string msg = string.Empty;

            switch (viewType)
            {
            case "portal":
                if (id.HasValue)
                {
                    Expression <Func <MixArticle, bool> > predicate = model => model.Id == id && model.Specificulture == _lang;
                    var portalResult = await base.GetSingleAsync <UpdateViewModel>($"{viewType}_{id}", predicate);

                    if (portalResult.IsSucceed)
                    {
                        portalResult.Data.DetailsUrl = MixCmsHelper.GetRouterUrl("Article", new { portalResult.Data.SeoName }, Request, Url);
                    }

                    return(Ok(JObject.FromObject(portalResult)));
                }
                else
                {
                    var model = new MixArticle()
                    {
                        Specificulture = _lang,
                        Status         = MixService.GetConfig <int>("DefaultStatus"),
                        Priority       = UpdateViewModel.Repository.Max(a => a.Priority).Data + 1
                    };

                    RepositoryResponse <UpdateViewModel> result = await base.GetSingleAsync <UpdateViewModel>($"{viewType}_default", null, model);

                    return(Ok(JObject.FromObject(result)));
                }

            default:
                if (id.HasValue)
                {
                    var beResult = await ReadMvcViewModel.Repository.GetSingleModelAsync(model => model.Id == id && model.Specificulture == _lang).ConfigureAwait(false);

                    if (beResult.IsSucceed)
                    {
                        beResult.Data.DetailsUrl = MixCmsHelper.GetRouterUrl("Article", new { beResult.Data.SeoName }, Request, Url);
                    }
                    return(Ok(JObject.FromObject(beResult)));
                }
                else
                {
                    var model = new MixArticle();
                    RepositoryResponse <ReadMvcViewModel> result = new RepositoryResponse <ReadMvcViewModel>()
                    {
                        IsSucceed = true,
                        Data      = new ReadMvcViewModel(model)
                        {
                            Specificulture = _lang,
                            Status         = MixContentStatus.Preview,
                        }
                    };
                    return(Ok(JObject.FromObject(result)));
                }
            }
        }
예제 #5
0
        public async Task <RepositoryResponse <PaginationModel <UserInfoViewModel> > > GetList(RequestPaging request)
        {
            Expression <Func <MixCmsUser, bool> > predicate = model =>
                                                              (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                              (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                               (
                                                                   model.Username.Contains(request.Keyword) ||
                                                                   model.FirstName.Contains(request.Keyword) ||
                                                                   model.LastName.Contains(request.Keyword)
                                                               )
                                                              ) &&
                                                              (!request.FromDate.HasValue ||
                                                               (model.CreatedDateTime >= request.FromDate.Value.ToUniversalTime())
                                                              ) &&
                                                              (!request.ToDate.HasValue ||
                                                               (model.CreatedDateTime <= request.ToDate.Value.ToUniversalTime())
                                                              );

            var data = await UserInfoViewModel.Repository.GetModelListByAsync(predicate, request.OrderBy, request.Direction, request.PageSize, request.PageIndex).ConfigureAwait(false);

            if (data.IsSucceed)
            {
                data.Data.Items.ForEach(a =>
                {
                    a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                        "Profile", new { a.Id }, Request, Url);
                }
                                        );
            }
            return(data);
        }
예제 #6
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  query     = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isPage    = int.TryParse(query.Get("page_id"), out int pageId);
            bool isArticle = int.TryParse(query.Get("article_id"), out int articleId);

            ParseRequestPagingDate(request);
            Expression <Func <MixPageArticle, bool> > predicate = model =>
                                                                  model.Specificulture == _lang &&
                                                                  (!isPage || model.CategoryId == pageId) &&
                                                                  (!isArticle || model.ArticleId == articleId) &&
                                                                  (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                                  (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                                   (model.Description.Contains(request.Keyword)
                                                                   ))
            ;
            string key = $"{request.Key}_{request.Query}_{request.PageSize}_{request.PageIndex}";

            switch (request.Key)
            {
            default:
                var listItemResult = await base.GetListAsync <ReadViewModel>(key, request, predicate);

                listItemResult.Data.Items.ForEach(n => n.IsActived          = true);
                listItemResult.Data.Items.ForEach(n => n.Article.DetailsUrl = MixCmsHelper.GetRouterUrl(
                                                      "article", new { id = n.Article.Id, seoName = n.Article.SeoName }, Request, Url));
                return(JObject.FromObject(listItemResult));
            }
        }
예제 #7
0
        public async Task <RepositoryResponse <string> > TranslateUrlAsync(string culture, string type, int id)
        {
            switch (type)
            {
            case "Post":
                var getPost = await Lib.ViewModels.MixPosts.ReadListItemViewModel.Repository.GetSingleModelAsync(
                    a => a.Id == id && a.Specificulture == culture);

                if (getPost.IsSucceed)
                {
                    return(new RepositoryResponse <string>()
                    {
                        IsSucceed = getPost.IsSucceed,
                        Data = MixCmsHelper.GetRouterUrl(new { action = "post", culture = _lang, id = getPost.Data.Id, getPost.Data.SeoName }, Request, Url)
                    });
                }
                else
                {
                    return(new RepositoryResponse <string>()
                    {
                        IsSucceed = getPost.IsSucceed,
                        Data = $"/{culture}"
                    });
                }

            case "Page":
                var getPage = await Lib.ViewModels.MixPages.ReadListItemViewModel.Repository.GetSingleModelAsync(
                    a => a.Id == id && a.Specificulture == culture);

                if (getPage.IsSucceed)
                {
                    return(new RepositoryResponse <string>()
                    {
                        IsSucceed = getPage.IsSucceed,
                        Data = MixCmsHelper.GetRouterUrl(
                            new { culture = _lang, seoName = getPage.Data.SeoName }, Request, Url)
                    });
                }
                else
                {
                    return(new RepositoryResponse <string>()
                    {
                        IsSucceed = true,
                        Data = $"/{culture}"
                    });
                }

            default:
                return(new RepositoryResponse <string>()
                {
                    IsSucceed = true,
                    Data = $"/{culture}"
                });
            }
        }
예제 #8
0
        protected void GeneratePageDetailsUrls(Lib.ViewModels.MixPages.ReadMvcViewModel page)
        {
            page.DetailsUrl = MixCmsHelper.GetRouterUrl(
                new { culture = culture, seoName = page.SeoName }, Request, Url);
            if (page.Posts != null)
            {
                foreach (var postNav in page.Posts.Items)
                {
                    if (postNav.Post != null)
                    {
                        postNav.Post.DetailsUrl = GenerateDetailsUrl(new { action = "post", culture = culture, id = postNav.PostId, seoName = postNav.Post.SeoName });
                    }
                }
            }

            if (page.Modules != null)
            {
                foreach (var nav in page.Modules)
                {
                    GeneratePageDetailsUrls(nav.Module);
                }
            }
        }
예제 #9
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  query       = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isPage      = int.TryParse(query.Get("page_id"), out int pageId);
            bool isNotPage   = int.TryParse(query.Get("not_page_id"), out int notPageId);
            bool isModule    = int.TryParse(query.Get("module_id"), out int moduleId);
            bool isNotModule = int.TryParse(query.Get("not_module_id"), out int notModuleId);

            ParseRequestPagingDate(request);
            Expression <Func <MixPost, bool> > predicate = model =>
                                                           model.Specificulture == _lang &&
                                                           (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                           (!isPage || model.MixPagePost.Any(nav => nav.PageId == pageId && nav.PostId == model.Id && nav.Specificulture == _lang)) &&
                                                           (!isNotPage || !model.MixPagePost.Any(nav => nav.PageId == notPageId && nav.PostId == model.Id && nav.Specificulture == _lang)) &&
                                                           (!isModule || model.MixModulePost.Any(nav => nav.ModuleId == moduleId && nav.PostId == model.Id)) &&
                                                           (!isNotModule || !model.MixModulePost.Any(nav => nav.ModuleId == notModuleId && nav.PostId == model.Id)) &&
                                                           (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                            (model.Title.Contains(request.Keyword) ||
                                                             model.Excerpt.Contains(request.Keyword))) &&
                                                           (!request.FromDate.HasValue ||
                                                            (model.CreatedDateTime >= request.FromDate.Value)
                                                           ) &&
                                                           (!request.ToDate.HasValue ||
                                                            (model.CreatedDateTime <= request.ToDate.Value)
                                                           );

            var nextSync = PublishPosts();

            switch (request.Key)
            {
            case "service.store":
                var srvResult = await base.GetListAsync <Lib.ViewModels.Services.Store.PostViewModel>(request, predicate);

                if (srvResult.IsSucceed)
                {
                    srvResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { action = "post", culture = _lang, id = a.Id, seoName = a.SeoName }, Request, Url);
                    });
                }
                return(Ok(JObject.FromObject(srvResult)));

            case "mvc":
                var mvcResult = await base.GetListAsync <ReadMvcViewModel>(request, predicate);

                if (mvcResult.IsSucceed)
                {
                    mvcResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { action = "post", culture = _lang, id = a.Id, seoName = a.SeoName }, Request, Url);
                    });
                }
                return(Ok(JObject.FromObject(mvcResult)));

            case "portal":
                var portalResult = await base.GetListAsync <UpdateViewModel>(request, predicate);

                if (portalResult.IsSucceed)
                {
                    portalResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { action = "post", culture = _lang, id = a.Id, seoName = a.SeoName }, Request, Url);
                    });
                }
                return(Ok(JObject.FromObject(portalResult)));

            default:

                var listItemResult = await base.GetListAsync <ReadListItemViewModel>(request, predicate);

                if (listItemResult.IsSucceed)
                {
                    listItemResult.Data.Items.ForEach((Action <ReadListItemViewModel>)(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { action = "post", culture = _lang, id = a.Id, seoName = a.SeoName }, Request, Url);
                    }));
                }

                return(JObject.FromObject(listItemResult));
            }
        }
예제 #10
0
 string GenerateDetailsUrl(string type, object routeValues)
 {
     return(MixCmsHelper.GetRouterUrl(type, routeValues, Request, Url));
 }
예제 #11
0
        public RepositoryResponse <FileViewModel> SiteMap()
        {
            try
            {
                XNamespace aw            = "http://www.sitemaps.org/schemas/sitemap/0.9";
                var        root          = new XElement(aw + "urlset");
                var        pages         = Lib.ViewModels.MixPages.ReadListItemViewModel.Repository.GetModelList();
                List <int> handledPageId = new List <int>();
                foreach (var page in pages.Data)
                {
                    page.DetailsUrl = MixCmsHelper.GetRouterUrl(
                        new { culture = page.Specificulture, seoName = page.SeoName }, Request, Url);
                    var otherLanguages = pages.Data.Where(p => p.Id == page.Id && p.Specificulture != page.Specificulture);
                    var lstOther       = new List <SitemapLanguage>();
                    foreach (var item in otherLanguages)
                    {
                        lstOther.Add(new SitemapLanguage()
                        {
                            HrefLang = item.Specificulture,
                            Href     = MixCmsHelper.GetRouterUrl(
                                new { culture = item.Specificulture, seoName = page.SeoName }, Request, Url)
                        });
                    }

                    var sitemap = new SiteMap()
                    {
                        ChangeFreq     = "monthly",
                        LastMod        = DateTime.UtcNow,
                        Loc            = page.DetailsUrl,
                        Priority       = 0.3,
                        OtherLanguages = lstOther
                    };
                    root.Add(sitemap.ParseXElement());
                }

                var posts = Lib.ViewModels.MixPosts.ReadListItemViewModel.Repository.GetModelList();
                foreach (var post in posts.Data)
                {
                    post.DetailsUrl = MixCmsHelper.GetRouterUrl(
                        new { culture = post.Specificulture, action = "post", id = post.Id, seoName = post.SeoName }, Request, Url);
                    var otherLanguages = pages.Data.Where(p => p.Id == post.Id && p.Specificulture != post.Specificulture);
                    var lstOther       = new List <SitemapLanguage>();
                    foreach (var item in otherLanguages)
                    {
                        lstOther.Add(new SitemapLanguage()
                        {
                            HrefLang = item.Specificulture,
                            Href     = MixCmsHelper.GetRouterUrl(
                                new { culture = item.Specificulture, seoName = post.SeoName }, Request, Url)
                        });
                    }
                    var sitemap = new SiteMap()
                    {
                        ChangeFreq     = "monthly",
                        LastMod        = DateTime.UtcNow,
                        Loc            = post.DetailsUrl,
                        OtherLanguages = lstOther,
                        Priority       = 0.3
                    };
                    root.Add(sitemap.ParseXElement());
                }

                string folder = $"Sitemaps";
                FileRepository.Instance.CreateDirectoryIfNotExist(folder);
                string filename = $"sitemap";
                string filePath = $"wwwroot/{folder}/{filename}.xml";
                root.Save(filePath);
                return(new RepositoryResponse <FileViewModel>()
                {
                    IsSucceed = true,
                    Data = new FileViewModel()
                    {
                        Extension = ".xml",
                        Filename = filename,
                        FileFolder = folder
                    }
                });
            }
            catch (Exception ex)
            {
                return(new RepositoryResponse <FileViewModel>()
                {
                    Exception = ex
                });
            }
        }
예제 #12
0
 protected string GenerateDetailsUrl(object routeValues)
 {
     return(MixCmsHelper.GetRouterUrl(routeValues, Request, Url));
 }
예제 #13
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  parsed  = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isLevel = int.TryParse(parsed.Get("level"), out int level);

            ParseRequestPagingDate(request);
            Expression <Func <MixPage, bool> > predicate = model =>
                                                           model.Specificulture == _lang &&
                                                           (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                           (!isLevel || model.Level == level) &&
                                                           (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                            (model.Title.Contains(request.Keyword) ||
                                                             model.Excerpt.Contains(request.Keyword))) &&
                                                           (!request.FromDate.HasValue ||
                                                            (model.CreatedDateTime >= request.FromDate.Value)
                                                           ) &&
                                                           (!request.ToDate.HasValue ||
                                                            (model.CreatedDateTime <= request.ToDate.Value)
                                                           );
            string key = $"{request.Key}_{request.PageSize}_{request.PageIndex}";

            switch (request.Key)
            {
            case "mvc":
                var mvcResult = await base.GetListAsync <ReadMvcViewModel>(key, request, predicate);

                if (mvcResult.IsSucceed)
                {
                    mvcResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "page", new { seoName = a.SeoName }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(mvcResult)));

            case "portal":
                var portalResult = await base.GetListAsync <UpdateViewModel>(key, request, predicate);

                if (portalResult.IsSucceed)
                {
                    portalResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "page", new { seoName = a.SeoName }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(portalResult)));

            default:

                var listItemResult = await base.GetListAsync <ReadListItemViewModel>(key, request, predicate);

                if (listItemResult.IsSucceed)
                {
                    listItemResult.Data.Items.ForEach((Action <ReadListItemViewModel>)(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "page", new { seoName = a.SeoName }, Request, Url);
                        a.Childs.ForEach((Action <Lib.ViewModels.MixPagePages.ReadViewModel>)(c =>
                        {
                            c.Page.DetailsUrl = MixCmsHelper.GetRouterUrl(
                                "page", new { seoName = c.Page.SeoName }, Request, Url);
                        }));
                    }));
                }

                return(JObject.FromObject(listItemResult));
            }
        }
예제 #14
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  parsed  = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isLevel = int.TryParse(parsed.Get("level"), out int level);

            ParseRequestPagingDate(request);
            Expression <Func <MixOrder, bool> > predicate = model =>
                                                            model.Specificulture == _lang &&
                                                            (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                            (string.IsNullOrWhiteSpace(request.Keyword)
                                                            ) &&
                                                            (!request.FromDate.HasValue ||
                                                             (model.CreatedDateTime >= request.FromDate.Value)
                                                            ) &&
                                                            (!request.ToDate.HasValue ||
                                                             (model.CreatedDateTime <= request.ToDate.Value)
                                                            );

            switch (request.Key)
            {
            case "mvc":
                var mvcResult = await base.GetListAsync <ReadViewModel>(request, predicate);

                if (mvcResult.IsSucceed)
                {
                    mvcResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { culture = _lang, action = "order", seoName = a.Id }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(mvcResult)));

            case "portal":
                var portalResult = await base.GetListAsync <UpdateViewModel>(request, predicate);

                if (portalResult.IsSucceed)
                {
                    portalResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { culture = _lang, action = "order", seoName = a.Id }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(portalResult)));

            default:

                var listItemResult = await base.GetListAsync <ReadListItemViewModel>(request, predicate);

                if (listItemResult.IsSucceed)
                {
                    listItemResult.Data.Items.ForEach((Action <ReadListItemViewModel>)(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            new { culture = _lang, action = "order", seoName = a.Id }, Request, Url);
                    }));
                }

                return(JObject.FromObject(listItemResult));
            }
        }
예제 #15
0
        public async Task <ActionResult <JObject> > GetList(
            [FromBody] RequestPaging request)
        {
            var  query    = HttpUtility.ParseQueryString(request.Query ?? "");
            bool isPage   = int.TryParse(query.Get("page_id"), out int pageId);
            bool isModule = int.TryParse(query.Get("module_id"), out int moduleId);

            ParseRequestPagingDate(request);
            Expression <Func <MixArticle, bool> > predicate = model =>
                                                              model.Specificulture == _lang &&
                                                              (!request.Status.HasValue || model.Status == request.Status.Value) &&
                                                              (!isPage || model.MixPageArticle.Any(nav => nav.CategoryId == pageId && nav.ArticleId == model.Id && nav.Specificulture == _lang)) &&
                                                              (!isModule || model.MixModuleArticle.Any(nav => nav.ModuleId == moduleId && nav.ArticleId == model.Id)) &&
                                                              (string.IsNullOrWhiteSpace(request.Keyword) ||
                                                               (model.Title.Contains(request.Keyword) ||
                                                                model.Excerpt.Contains(request.Keyword))) &&
                                                              (!request.FromDate.HasValue ||
                                                               (model.CreatedDateTime >= request.FromDate.Value)
                                                              ) &&
                                                              (!request.ToDate.HasValue ||
                                                               (model.CreatedDateTime <= request.ToDate.Value)
                                                              );
            string key = $"{request.Key}_{request.Query}_{request.PageSize}_{request.PageIndex}";

            switch (request.Key)
            {
            case "mvc":
                var mvcResult = await base.GetListAsync <ReadMvcViewModel>(key, request, predicate);

                if (mvcResult.IsSucceed)
                {
                    mvcResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "article", new { seoName = a.SeoName }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(mvcResult)));

            case "portal":
                var portalResult = await base.GetListAsync <UpdateViewModel>(key, request, predicate);

                if (portalResult.IsSucceed)
                {
                    portalResult.Data.Items.ForEach(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "article", new { seoName = a.SeoName }, Request, Url);
                    });
                }

                return(Ok(JObject.FromObject(portalResult)));

            default:

                var listItemResult = await base.GetListAsync <ReadListItemViewModel>(key, request, predicate);

                if (listItemResult.IsSucceed)
                {
                    listItemResult.Data.Items.ForEach((Action <ReadListItemViewModel>)(a =>
                    {
                        a.DetailsUrl = MixCmsHelper.GetRouterUrl(
                            "article", new { seoName = a.SeoName }, Request, Url);
                    }));
                }

                return(JObject.FromObject(listItemResult));
            }
        }