I am trying to figure out how to check a property of my EF 6 model to see if it contains a value or not. The property is an INt64 so I can't use string.Empty
and I can not just compare it to an empty string with out converting it. How can I modify this check so it will return "No" if there is no value in "LogoFileID"?
HasLogo = (section.LogoFileID != string.Empty) ? "Yes" : "No";
Here is my model
public class Section
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Int16 ID { get; set; }
public Int64? LogoFileID { get; set; }
[Required, MaxLength(250), Column(TypeName = "varchar")]
public string RouteName { get; set; }
[Required, MaxLength(15), Column(TypeName = "varchar")]
public string Type { get; set; }
[Required]
public string Title { get; set; }
public string Synopsis { get; set; }
[ForeignKey("LogoFileID")]
public virtual File Logo { get; set; }
}