public BooksGridBuilder(ISession sess, BooksGridDTO values, string defaultSortField) : base(sess, values, defaultSortField) { bool isInitial = values.Genre.IndexOf(FilterPrefix.Genre) == -1; routes.AuthorFilter = (isInitial) ? FilterPrefix.Author + values.Author : values.Author; routes.GenreFilter = (isInitial) ? FilterPrefix.Genre + values.Genre : values.Genre; routes.PriceFilter = (isInitial) ? FilterPrefix.Price + values.Price : values.Price; }
// this constructor stores filtering route segments, as well as // the paging and sorting route segments stored by the base constructor public BooksGridBuilder(ISession sess, BooksGridDTO values, string defaultSortField) : base(sess, values, defaultSortField) { // store filter route segments - add filter prefixes if this is initial load // of page with default values rather than route values (route values have prefix) bool isInitial = values.Genre.IndexOf(FilterPrefix.Genre) == -1; routes.AuthorFilter = (isInitial) ? FilterPrefix.Author + values.Author : values.Author; routes.GenreFilter = (isInitial) ? FilterPrefix.Genre + values.Genre : values.Genre; routes.PriceFilter = (isInitial) ? FilterPrefix.Price + values.Price : values.Price; }