Two things here:
You don't need to cast the property value to an
Int32
, asTypeMedia()
accepts astring
orobject
id parameter.You can use the
Url
property of theIPublishedContent
instead ofGetPropertyValue("umbracoFile")
So it becomes:
<img src="@Umbraco.TypedMedia(Model.Content.GetPropertyValue("siteLogo")).Url"/>
Which is much nicer isn't it? There are obviously many ways to shortne this, extension methods but one that a friend showed me recently was uMapper which allows you to create strongly typed objects corresponding to your document types, working much like AutoMapper. For a little leg work up front, your code can become much more understandable and concise.