How to Strongly Type to Models

OLD:

case VideoItem.ModelTypeAlias:
                        if (article.HasValue("contentLabel"))
                        {
                            docType = article.GetPropertyValue<IPublishedContent>("contentLabel").Name;
                            break;
                        }
                        else
                        {
                            docType = "Video";
                            break;
                        }

New:

case VideoItem.ModelTypeAlias:
    docType = "Video";
    if(article is VideoItem videoItem && videoItem.ContentLabel != null)
    {
       docType = videoItem.ContentLabel.Name;
    }

Last updated