/// <summary> /// The supply with download url. /// </summary> /// <param name="version"> /// The version. /// </param> /// <param name="urlHelper"> /// The url helper. /// </param> /// <returns> /// The <see cref="Version"/>. /// </returns> public static Version SupplyWithDownloadUrl(this Version version, UrlHelper urlHelper, IDownloadLinkProvider downloadLinkProvider) { version.DownloadUrl = urlHelper.Link(downloadLinkProvider.RouteName, new { controller = downloadLinkProvider.ControllerName, action = downloadLinkProvider.ActionName, id = version.Id }); return(version); }
/// <summary> /// Initializes a new instance of the <see cref="VersionsController"/> class. /// </summary> /// <param name="repository"> /// The repository. /// </param> /// <param name="downloadLinkProvider"> /// The download Link Provider. /// </param> public VersionsController(IVersionRepository repository, IDownloadLinkProvider downloadLinkProvider) { repository.Server = HttpContext.Current.Server; this.repository = repository; this.downloadLinkProvider = downloadLinkProvider; }
/// <summary> /// The supply with download url. /// </summary> /// <param name="list"> /// The list. /// </param> /// <param name="urlHelper"> /// The url helper. /// </param> /// <returns> /// The <see cref="IEnumerable"/>. /// </returns> public static IEnumerable <Version> SupplyWithDownloadUrl(this IEnumerable <Version> list, UrlHelper urlHelper, IDownloadLinkProvider downloadLinkProvider) { return(list.Select(version => version.SupplyWithDownloadUrl(urlHelper, downloadLinkProvider))); }