Created
August 20, 2015 18:21
-
-
Save JRondeau16/908652b171eeb018218f to your computer and use it in GitHub Desktop.
Various ways to output information from the HoursOfOperationModel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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