Skip to content

Commit

Permalink
Display calories and price in tables by size and edit other styles
Browse files Browse the repository at this point in the history
  • Loading branch information
awbooze committed Dec 9, 2019
1 parent ba85fd2 commit caed250
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 22 deletions.
96 changes: 86 additions & 10 deletions Website/Pages/Menu.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,28 @@
{
<div class="menu-item">
<div class="menu-description"><h3>@item.Description</h3></div>
<div class="menu-price">$@item.Price.ToString("N2")</div>
<div class="menu-calories">@item.Calories Calories</div>
<div class="menu-size-table">
<table>
<thead>
<tr>
<th>Size</th>
<th>Price</th>
<th>Calories</th>
</tr>
</thead>
<tbody>
@foreach (var size in Model.Sizes)
{
item.Size = size;
<tr>
<th>@item.Size</th>
<td>$@item.Price.ToString("N2")</td>
<td>@item.Calories</td>
</tr>
}
</tbody>
</table>
</div>
<div class="menu-ingredients">
<p>Ingredients</p>
<ul>
Expand All @@ -50,8 +70,24 @@
{
<div class="menu-item">
<div class="menu-description"><h3>@item.Description</h3></div>
<div class="menu-price">$@item.Price.ToString("N2")</div>
<div class="menu-calories">@item.Calories Calories</div>
<div class="menu-size-table">
<table>
<thead>
<tr>
<th>Size</th>
<th>Price</th>
<th>Calories</th>
</tr>
</thead>
<tbody>
<tr>
<th>Entree</th>
<td>$@item.Price.ToString("N2")</td>
<td>@item.Calories</td>
</tr>
</tbody>
</table>
</div>
<div class="menu-ingredients">
<p>Ingredients</p>
<ul>
Expand All @@ -75,9 +111,29 @@
@foreach (var item in Model.AvailableSides)
{
<div class="menu-item">
<div class="menu-description"><h3>@item.Description</h3></div>
<div class="menu-price">$@item.Price.ToString("N2")</div>
<div class="menu-calories">@item.Calories Calories</div>
<div class="menu-description"><h3>@item.Description.Replace("Small", "")</h3></div>
<div class="menu-size-table">
<table>
<thead>
<tr>
<th>Size</th>
<th>Price</th>
<th>Calories</th>
</tr>
</thead>
<tbody>
@foreach (var size in Model.Sizes)
{
item.Size = size;
<tr>
<th>@item.Size</th>
<td>$@item.Price.ToString("N2")</td>
<td>@item.Calories</td>
</tr>
}
</tbody>
</table>
</div>
<div class="menu-ingredients">
<p>Ingredients</p>
<ul>
Expand All @@ -100,9 +156,29 @@
@foreach (var item in Model.AvailableDrinks)
{
<div class="menu-item">
<div class="menu-description"><h3>@item.Description</h3></div>
<div class="menu-price">$@item.Price.ToString("N2")</div>
<div class="menu-calories">@item.Calories Calories</div>
<div class="menu-description"><h3>@item.Description.Replace("Small", "")</h3></div>
<div class="menu-size-table">
<table>
<thead>
<tr>
<th>Size</th>
<th>Price</th>
<th>Calories</th>
</tr>
</thead>
<tbody>
@foreach (var size in Model.Sizes)
{
item.Size = size;
<tr>
<th>@item.Size</th>
<td>$@item.Price.ToString("N2")</td>
<td>@item.Calories</td>
</tr>
}
</tbody>
</table>
</div>
<div class="menu-ingredients">
<p>Ingredients</p>
<ul>
Expand Down
18 changes: 10 additions & 8 deletions Website/Pages/Menu.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class MenuModel : PageModel
/// </summary>
public IEnumerable<Drink> AvailableDrinks { get; private set; } = null;

public List<Size> Sizes { get; } = new List<Size> { Size.Small, Size.Medium, Size.Large };

/// <summary>
/// The search term when a search is executed through the search and filter button.
/// </summary>
Expand Down Expand Up @@ -107,20 +109,20 @@ public void OnPost()
if (search != null)
{
//AvailableCombos = Menu.Search(AvailableCombos, search);
AvailableCombos = AvailableCombos.Where(item => item.Description.Contains(search,
StringComparison.CurrentCultureIgnoreCase));
AvailableCombos = AvailableCombos.Where(item => item.Description.Replace("Small", "")
.Contains(search, StringComparison.CurrentCultureIgnoreCase));

//AvailableEntrees = Menu.Search(AvailableEntrees, search);
AvailableEntrees = AvailableEntrees.Where(item => item.Description.Contains(search,
StringComparison.CurrentCultureIgnoreCase));
AvailableEntrees = AvailableEntrees.Where(item => item.Description.Replace("Small", "")
.Contains(search, StringComparison.CurrentCultureIgnoreCase));

//AvailableSides = Menu.Search(AvailableSides, search);
AvailableSides = AvailableSides.Where(item => item.Description.Contains(search,
StringComparison.CurrentCultureIgnoreCase));
AvailableSides = AvailableSides.Where(item => item.Description.Replace("Small", "")
.Contains(search, StringComparison.CurrentCultureIgnoreCase));

//AvailableDrinks = Menu.Search(AvailableDrinks, search);
AvailableDrinks = AvailableDrinks.Where(item => item.Description.Contains(search,
StringComparison.CurrentCultureIgnoreCase));
AvailableDrinks = AvailableDrinks.Where(item => item.Description.Replace("Small", "")
.Contains(search, StringComparison.CurrentCultureIgnoreCase));
}

if (menuCategory.Count > 0)
Expand Down
18 changes: 14 additions & 4 deletions Website/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,34 @@ form {
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
border-bottom: 0.1em solid black;
border-bottom: 0.1em solid green;
}

.menu-item {
display: inline-block;
vertical-align: top;
margin: 1em auto;
flex-basis: 30%;
}

.menu-description {
margin: auto;
text-align: center;
}

.menu-item p {
margin: 0.5em 0 0 0;
}

.menu-description {
margin: auto;
table, th, td {
border: 0.1em solid green;
border-collapse: collapse;
text-align: center;
}

table {
margin: 0.5em auto;
width: 95%;
}
/* End Content styles */

/* Footer */
Expand Down

0 comments on commit caed250

Please sign in to comment.