Skip to content

Instantly share code, notes, and snippets.

@JRondeau16
Created August 20, 2015 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JRondeau16/908652b171eeb018218f to your computer and use it in GitHub Desktop.
Save JRondeau16/908652b171eeb018218f to your computer and use it in GitHub Desktop.
Various ways to output information from the HoursOfOperationModel
@model DEG.SC.HoursOfOperation.Web.Models.HoursOfOperationModel
@*Is the business open 24 hours a day?*@
@if (Model.OpenTwentyFourHours)
{
<div>Open 24 Hours!</div>
}
@*Various ways of accessing the days of the week*@
Monday: Open @Model[DayOfWeek.Monday].OpeningTime to @Model[DayOfWeek.Monday].ClosingTime
Tuesday: @(Model[DayOfWeek.Tuesday].IsClosed ? "Closed" : "Open")
@Model[DayOfWeek.Wednesday].DayOfWeek: Open @Model[DayOfWeek.Wednesday].OpeningTime to @Model[DayOfWeek.Wednesday].ClosingTime
@*Ability to loop through each day*@
@foreach (var day in Model.Days)
{
if (day.IsClosed)
{
<div>@day.DayOfWeek: Closed</div>
}
else
{
<div>@day.DayOfWeek: @day.OpeningTime to @day.ClosingTime</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment