I need to access an ID to an adam file setup like this:
MyDocument is the field name, where users can load an image or whatever. In a list style view, users will click a link that activates a detail view for that image.
The link will be something like mysite.com/mytab/detailsforfile/fileId
The details view will parse the fileId and load the image.
So, two questions:
Is the native DNN file: 123 the only way? Or does 2sxc or adam have some specific ids?
Edit: A practical example would probably help:
This list view will have:
@foreach(var car in eCars) {
<div>
<strong>@car.Name</strong>
<img class="img-fluid" src="@car.carImageOne">
<a href="@("/whatever/" + IDFORTHISIMAGE)">See full image...</a>
<img class="img-fluid" src="@car.carImageTwo">
<a href="@("/whatever/" + IDFORTHISIMAGE)">See full image...</a>
</div>
}
And the details view:
@{
var qsImageId = Request.QueryString["whatever"];
//cast and double check the qs int
var imageURL = ??; // How do I get the file url based on the id?
}
<div>
//embed nice frame, ads, whatever
<img class="img-fluid" src="@imageURL">
</div>
To get the file ID I used this:
var getFile = AsAdam(Entity, "field").Files as System.Collections.Generic.IEnumerable<dynamic>;
get fileId = getFile.First().FileId;
To get the url from the id:
var myFile = FileManager.Instance.GetFile(FileId);
var myurl = FileManager.Instance.GetUrl(myFile);