Professional Documents
Culture Documents
Lesson13 - Examples (PS11-12 Hoh Jungi)
Lesson13 - Examples (PS11-12 Hoh Jungi)
Lesson13 - Examples (PS11-12 Hoh Jungi)
Lesson13Eg1
Filename: .\Pages\Index.cshtml
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome Jungi</h1>
<p><a href="Calculator">Jungi's Calculator</a></p>
</div>
After filling in the text boxes and clicking on the “Pearls” and “Custard” checkboxes and “No Ice”
radio button automatically enabled
After filling in the text boxes and clicking on the "Add" button
After filling in the text boxes and clicking on the "Subtract" button
Filename: .\Pages\BubbleTea.cshtml
@page
@model RazorPagesBasics.Pages.BubbleTeaModel
@{
ViewData["Title"] = "Bubble Tea Shop";
}
<h1>Bubble Tea</h1>
<form method="post">
<p>
Name: <input type="text" asp-for="Name" />
Contact Number: <input type="text" asp-for="ContactNumber" />
</p>
<p>
<input type="radio" asp-for="IceOption" value="With Ice" disabled />With Ice<br />
<input type="radio" asp-for="IceOption" value="No Ice" checked="checked" />No Ice<br />
</p>
<p>
<input type="checkbox" asp-for="AddBubble" /> Pearls<br />
<input type="checkbox" asp-for="AddCustard" /> Custard<br />
</p>
<p>
<input type="submit" value="OK" />
</p>
<p>Customer Information: @Model.CustomerInfo</p>
<p>Order Information: @Model.OrderInfo</p>
<p>Total Cost: @Model.TotalCost</p>
</form>
Filename: .\Pages\BubbleTea.cshtml.cs
namespace RazorPagesBasics.Pages
{
public class BubbleTeaModel : PageModel
{
[BindProperty]
public string Name { get; set; }
[BindProperty]
public string ContactNumber { get; set; }
[BindProperty]
public string IceOption { get; set; }
[BindProperty]
public bool AddBubble { get; set; }
[BindProperty]
public bool AddCustard { get; set; }
public string CustomerInfo { get; set; }
public string OrderInfo { get; set; }