我为代码中的开放时间定义了一个列表,其后有两个项目“ day”和“ hours”,我需要通过循环在mvc视图中读取这些值并将其设置为schema.org “营业时间规范”
有没有办法做到这一点 公共列表formatedDayOpeningHours {get;组; }
public class FormatedDayOpeningHours
{
public string day { get; set; }
public string hours { get; set; }
}
Schema.org标签
<script type="application/ld+json">
{
"@context": "https://schema.org/","@type": "AutomotiveBusiness","name": @Model.name,"telephone": @Model.phone,"address": {
"@type": "AutomotiveBusiness.PostalAddress","streetaddress": @Model.streetComplete,"addressLocality": @Model.city,"postalCode": @Model.postcode,"addressCountry": @Model.country
}
"openingHoursspecification":
[
{
"@@type": "OpeningHoursspecification","dayOfWeek": "Monday","opens": "11:30","closes": "11:30"
},{
"@@type": "OpeningHoursspecification","dayOfWeek": "Tuesday","closes": "22:00"
},"dayOfWeek": "Wednesday","dayOfWeek": "Thursday","dayOfWeek": "Friday","closes": "22:00"
}
]
</script>
我想从模型中读取“天”和“小时”的值并将其设置在视图上。