Exemplo n.º 1
0
        public IndexRouteParams(IndexRouteParams source, int? page)
        {
            ParamIs.NotNull(() => source);

            artistType = (source.artistType != ArtistType.Unknown ? source.artistType : null);
            draftsOnly = (source.draftsOnly == true ? source.draftsOnly : null);
            filter = source.filter;
            matchMode = source.matchMode;
            sort = source.sort;
            this.page = page;
        }
Exemplo n.º 2
0
        public ArtistIndex(PartialFindResult<ArtistWithAdditionalNamesContract> result, string filter,
            ArtistType artistType, bool? draftsOnly, ArtistSortRule sort, int? page, IndexRouteParams routeParams)
        {
            Artists = new StaticPagedList<ArtistWithAdditionalNamesContract>(result.Items, page ?? 1, 30, result.TotalCount);
            DraftsOnly = draftsOnly ?? false;
            Filter = filter;
            ArtistType = artistType;
            Sort = sort;
            RouteParams = routeParams;

            FilterableArtistTypes = EnumVal<ArtistType>.Values.ToDictionary(a => a, Translate.ArtistTypeName);
        }
Exemplo n.º 3
0
 public ActionResult Index(IndexRouteParams routeParams)
 {
     return RedirectToAction("Index", "Search", new SearchRouteParams {
         searchType = EntryType.Artist, filter = routeParams.filter, sort = routeParams.sort,
         artistType = routeParams.artistType
     });
 }
Exemplo n.º 4
0
        //
        // GET: /Artist/
        public ActionResult Index(IndexRouteParams routeParams)
        {
            WebHelper.VerifyUserAgent(Request);

            var artistType = routeParams.artistType ?? ArtistType.Unknown;
            var filter = routeParams.filter;
            var page = routeParams.page;
            var draftsOnly = routeParams.draftsOnly;
            var matchMode = routeParams.matchMode ?? NameMatchMode.Auto;
            var sortRule = routeParams.sort ?? ArtistSortRule.Name;

            if (matchMode == NameMatchMode.Auto && filter != null && filter.Length <= 2)
                matchMode = NameMatchMode.StartsWith;

            var queryParams = new ArtistQueryParams(filter,
                artistType != ArtistType.Unknown ? new[] { artistType } : new ArtistType[] { },
                ((page ?? 1) - 1) * 30, 30, draftsOnly ?? false, true, matchMode, sortRule, false);

            var result = Service.FindArtists(queryParams);

            if (page == null && result.TotalCount == 1 && result.Items.Length == 1) {
                return RedirectToAction("Details", new { id = result.Items[0].Id });
            }

            var model = new ArtistIndex(result, filter, artistType, draftsOnly, sortRule, page, routeParams);

            return View(model);
        }