In my code I use an if statement to check if the model is not null, so that I can use the same view for adding and editing new items.
I have used an if statement to only render the view file button when editing the node and if it actually has a file to view.
I am not entirely happy with it though. It looks terrible. I would like to avoid using if statements in my view if possible. Does anyone know how I could do that?
<label class="input-group-addon" asp-for="FloorPlan"></label>
<input class="form-control" asp-for="FloorPlan" />
@if (Model != null)
<a class="input-group-addon" asp-action="ViewFile" asp-route-id=@Model.Id asp-route-fileName="floor" target="_blank">View File</a>