/// <summary> /// Initializes a new instance of the <see cref="PagedListResult" /> class. /// </summary> /// <param name="list">The content.</param> /// <param name="controller">The controller.</param> public PagedListContentResult(IList <T> list, int offset, int limit, string routeName, ApiController controller) : base(new PagedListResult <T>(list.Take(limit).ToList()), controller) { if (list == null) { throw new ArgumentNullException("list"); } _content = new PagedListResult <T>(list.Take(limit).ToList()); _offset = offset; _limit = limit; HasPrev = offset > 0; HasNext = list.Count > limit; _routeName = routeName; }
/// <summary> /// Initializes a new instance of the <see cref="PagedListResult{T}" /> class with the values provided. /// </summary> /// <param name="list">The content value to negotiate and format in the entity body.</param> /// <param name="contentNegotiator">The content negotiator to handle content negotiation.</param> /// <param name="request">The request message which led to this result.</param> /// <param name="formatters">The formatters to use to negotiate and format the content.</param> public PagedListContentResult(IList <T> list, int offset, int limit, string routeName, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable <MediaTypeFormatter> formatters) : base(null, contentNegotiator, request, formatters) { if (list == null) { throw new ArgumentNullException("list"); } _content = new PagedListResult <T>(list.Take(limit).ToList()); _offset = offset; _limit = limit; HasPrev = offset > 0; HasNext = list.Count > limit; _routeName = routeName; }