build out checkout form

This commit is contained in:
2023-11-03 15:30:43 -05:00
parent 014cc48bba
commit e386edb011
27 changed files with 781 additions and 17 deletions

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace FakePieShop.Controllers
{
public class ContactController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@@ -0,0 +1,22 @@
using FakePieShop.Models;
using Microsoft.AspNetCore.Mvc;
namespace BethanysPieShop.Controllers
{
public class OrderController : Controller
{
private readonly IOrderRepository _orderRepository;
private readonly IShoppingCart _shoppingCart;
public OrderController(IOrderRepository orderRepository, IShoppingCart shoppingCart)
{
_orderRepository = orderRepository;
_shoppingCart = shoppingCart;
}
public IActionResult Checkout()
{
return View();
}
}
}

View File

@@ -0,0 +1,266 @@
// <auto-generated />
using System;
using FakePieShop.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FakePieShop.Migrations
{
[DbContext(typeof(FakePieShopDbContext))]
[Migration("20231103202102_AddOrderSupport")]
partial class AddOrderSupport
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.13")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("FakePieShop.Models.Category", b =>
{
b.Property<int>("CategoryId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CategoryId"));
b.Property<string>("CategoryName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.HasKey("CategoryId");
b.ToTable("Categories");
});
modelBuilder.Entity("FakePieShop.Models.Order", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"));
b.Property<string>("AddressLine1")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("AddressLine2")
.HasColumnType("nvarchar(max)");
b.Property<string>("City")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Country")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("OrderPlaced")
.HasColumnType("datetime2");
b.Property<decimal>("OrderTotal")
.HasColumnType("decimal(18,2)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("nvarchar(25)");
b.Property<string>("State")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.HasKey("OrderId");
b.ToTable("Orders");
});
modelBuilder.Entity("FakePieShop.Models.OrderDetail", b =>
{
b.Property<int>("OrderDetailId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderDetailId"));
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("PieId")
.HasColumnType("int");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("OrderDetailId");
b.HasIndex("OrderId");
b.HasIndex("PieId");
b.ToTable("OrderDetails");
});
modelBuilder.Entity("FakePieShop.Models.Pie", b =>
{
b.Property<int>("PieId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("PieId"));
b.Property<string>("AllergyInformation")
.HasColumnType("nvarchar(max)");
b.Property<int>("CategoryId")
.HasColumnType("int");
b.Property<string>("ImageThumbnailUrl")
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b.Property<bool>("InStock")
.HasColumnType("bit");
b.Property<bool>("IsPieOfTheWeek")
.HasColumnType("bit");
b.Property<string>("LongDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.Property<string>("ShortDescription")
.HasColumnType("nvarchar(max)");
b.HasKey("PieId");
b.HasIndex("CategoryId");
b.ToTable("Pies");
});
modelBuilder.Entity("FakePieShop.Models.ShoppingCartItem", b =>
{
b.Property<int>("ShoppingCartItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ShoppingCartItemId"));
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<int>("PieId")
.HasColumnType("int");
b.Property<string>("ShoppingCartId")
.HasColumnType("nvarchar(max)");
b.HasKey("ShoppingCartItemId");
b.HasIndex("PieId");
b.ToTable("ShoppingCartItems");
});
modelBuilder.Entity("FakePieShop.Models.OrderDetail", b =>
{
b.HasOne("FakePieShop.Models.Order", "Order")
.WithMany("OrderDetails")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FakePieShop.Models.Pie", "Pie")
.WithMany()
.HasForeignKey("PieId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Pie");
});
modelBuilder.Entity("FakePieShop.Models.Pie", b =>
{
b.HasOne("FakePieShop.Models.Category", "Category")
.WithMany("Pies")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
});
modelBuilder.Entity("FakePieShop.Models.ShoppingCartItem", b =>
{
b.HasOne("FakePieShop.Models.Pie", "Pie")
.WithMany()
.HasForeignKey("PieId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pie");
});
modelBuilder.Entity("FakePieShop.Models.Category", b =>
{
b.Navigation("Pies");
});
modelBuilder.Entity("FakePieShop.Models.Order", b =>
{
b.Navigation("OrderDetails");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FakePieShop.Migrations
{
/// <inheritdoc />
public partial class AddOrderSupport : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
OrderId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FirstName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
LastName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AddressLine1 = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
AddressLine2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
ZipCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
City = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
State = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
Country = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PhoneNumber = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: false),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
OrderTotal = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
OrderPlaced = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.OrderId);
});
migrationBuilder.CreateTable(
name: "OrderDetails",
columns: table => new
{
OrderDetailId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OrderId = table.Column<int>(type: "int", nullable: false),
PieId = table.Column<int>(type: "int", nullable: false),
Amount = table.Column<int>(type: "int", nullable: false),
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderDetails", x => x.OrderDetailId);
table.ForeignKey(
name: "FK_OrderDetails_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "OrderId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderDetails_Pies_PieId",
column: x => x.PieId,
principalTable: "Pies",
principalColumn: "PieId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_OrderDetails_OrderId",
table: "OrderDetails",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderDetails_PieId",
table: "OrderDetails",
column: "PieId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrderDetails");
migrationBuilder.DropTable(
name: "Orders");
}
}
}

View File

@@ -1,4 +1,5 @@
// <auto-generated /> // <auto-generated />
using System;
using FakePieShop.Models; using FakePieShop.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -41,6 +42,101 @@ namespace FakePieShop.Migrations
b.ToTable("Categories"); b.ToTable("Categories");
}); });
modelBuilder.Entity("FakePieShop.Models.Order", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"));
b.Property<string>("AddressLine1")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("AddressLine2")
.HasColumnType("nvarchar(max)");
b.Property<string>("City")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Country")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("OrderPlaced")
.HasColumnType("datetime2");
b.Property<decimal>("OrderTotal")
.HasColumnType("decimal(18,2)");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(25)
.HasColumnType("nvarchar(25)");
b.Property<string>("State")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.HasKey("OrderId");
b.ToTable("Orders");
});
modelBuilder.Entity("FakePieShop.Models.OrderDetail", b =>
{
b.Property<int>("OrderDetailId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderDetailId"));
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("PieId")
.HasColumnType("int");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.HasKey("OrderDetailId");
b.HasIndex("OrderId");
b.HasIndex("PieId");
b.ToTable("OrderDetails");
});
modelBuilder.Entity("FakePieShop.Models.Pie", b => modelBuilder.Entity("FakePieShop.Models.Pie", b =>
{ {
b.Property<int>("PieId") b.Property<int>("PieId")
@@ -111,6 +207,25 @@ namespace FakePieShop.Migrations
b.ToTable("ShoppingCartItems"); b.ToTable("ShoppingCartItems");
}); });
modelBuilder.Entity("FakePieShop.Models.OrderDetail", b =>
{
b.HasOne("FakePieShop.Models.Order", "Order")
.WithMany("OrderDetails")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FakePieShop.Models.Pie", "Pie")
.WithMany()
.HasForeignKey("PieId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Pie");
});
modelBuilder.Entity("FakePieShop.Models.Pie", b => modelBuilder.Entity("FakePieShop.Models.Pie", b =>
{ {
b.HasOne("FakePieShop.Models.Category", "Category") b.HasOne("FakePieShop.Models.Category", "Category")
@@ -137,6 +252,11 @@ namespace FakePieShop.Migrations
{ {
b.Navigation("Pies"); b.Navigation("Pies");
}); });
modelBuilder.Entity("FakePieShop.Models.Order", b =>
{
b.Navigation("OrderDetails");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@@ -12,5 +12,7 @@ namespace FakePieShop.Models
public DbSet<Category> Categories { get; set; } public DbSet<Category> Categories { get; set; }
public DbSet<Pie> Pies { get; set; } public DbSet<Pie> Pies { get; set; }
public DbSet<ShoppingCartItem> ShoppingCartItems { get; set; } public DbSet<ShoppingCartItem> ShoppingCartItems { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
} }
} }

View File

@@ -0,0 +1,7 @@
namespace FakePieShop.Models
{
public interface IOrderRepository
{
void CreateOrder(Order order);
}
}

View File

@@ -0,0 +1,66 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.ComponentModel.DataAnnotations;
namespace FakePieShop.Models
{
public class Order
{
[BindNever]
public int OrderId { get; set; }
public List<OrderDetail>? OrderDetails { get; set; }
[Required(ErrorMessage = "Please enter your first name")]
[Display(Name = "First name")]
[StringLength(50)]
public string FirstName { get; set; } = string.Empty;
[Required(ErrorMessage = "Please enter your last name")]
[Display(Name = "Last name")]
[StringLength(50)]
public string LastName { get; set; } = string.Empty;
[Required(ErrorMessage = "Please enter your address")]
[StringLength(100)]
[Display(Name = "Address Line 1")]
public string AddressLine1 { get; set; } = string.Empty;
[Display(Name = "Address Line 2")]
public string? AddressLine2 { get; set; }
[Required(ErrorMessage = "Please enter your zip code")]
[Display(Name = "Zip code")]
[StringLength(10, MinimumLength = 4)]
public string ZipCode { get; set; } = string.Empty;
[Required(ErrorMessage = "Please enter your city")]
[StringLength(50)]
public string City { get; set; } = string.Empty;
[StringLength(10)]
public string? State { get; set; }
[Required(ErrorMessage = "Please enter your country")]
[StringLength(50)]
public string Country { get; set; } = string.Empty;
[Required(ErrorMessage = "Please enter your phone number")]
[StringLength(25)]
[DataType(DataType.PhoneNumber)]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; } = string.Empty;
[Required]
[StringLength(50)]
[DataType(DataType.EmailAddress)]
[RegularExpression(@"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])",
ErrorMessage = "The email address is not entered in a correct format")]
public string Email { get; set; } = string.Empty;
[BindNever]
public decimal OrderTotal { get; set; }
[BindNever]
public DateTime OrderPlaced { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace FakePieShop.Models
{
public class OrderDetail
{
public int OrderDetailId { get; set; }
public int OrderId { get; set; }
public int PieId { get; set; }
public int Amount { get; set; }
public decimal Price { get; set; }
public Pie Pie { get; set; } = default!;
public Order Order { get; set; } = default!;
}
}

View File

@@ -0,0 +1,40 @@
namespace FakePieShop.Models
{
public class OrderRepository : IOrderRepository
{
private readonly FakePieShopDbContext _fakePieShopDbContext;
private readonly IShoppingCart _shoppingCart;
public OrderRepository(FakePieShopDbContext fakePieShopDbContext, IShoppingCart shoppingCart)
{
_fakePieShopDbContext = fakePieShopDbContext;
_shoppingCart = shoppingCart;
}
public void CreateOrder(Order order)
{
order.OrderPlaced = DateTime.Now;
List<ShoppingCartItem>? shoppingCartItems = _shoppingCart.ShoppingCartItems;
order.OrderTotal = _shoppingCart.GetShoppingCartTotal();
order.OrderDetails = new List<OrderDetail>();
foreach (ShoppingCartItem? shoppingCartItem in shoppingCartItems)
{
var orderDetail = new OrderDetail
{
Amount = shoppingCartItem.Amount,
PieId = shoppingCartItem.Pie.PieId,
Price = shoppingCartItem.Pie.Price
};
order.OrderDetails.Add(orderDetail);
}
_fakePieShopDbContext.Orders.Add(order);
_fakePieShopDbContext.SaveChanges();
}
}
}

View File

@@ -8,6 +8,7 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// add services to application // add services to application
builder.Services.AddScoped<IPieRepository, PieRepository>(); builder.Services.AddScoped<IPieRepository, PieRepository>();
builder.Services.AddScoped<ICategoryRepository, CategoryRepository>(); builder.Services.AddScoped<ICategoryRepository, CategoryRepository>();
builder.Services.AddScoped<IOrderRepository, OrderRepository>();
builder.Services.AddScoped<IShoppingCart, ShoppingCart>(services => ShoppingCart.GetCart(services)); builder.Services.AddScoped<IShoppingCart, ShoppingCart>(services => ShoppingCart.GetCart(services));
// include support for sessions and http context // include support for sessions and http context

View File

@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace FakePieShop.TagHelpers
{
public class EmailTagHelper : TagHelper
{
public string? Address { get; set; }
public string? Content { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "a";
output.Attributes.SetAttribute("href", $"mailto:{Address}");
output.Content.SetContent(Content);
//base.Process(context, output);
}
}
}

View File

@@ -0,0 +1,14 @@
<h3 class="my-5">
Contact Us
</h3>
<div class="row gx-5">
<img src="~/Images/contact/contact.jpg" class="img-fluid col-5" />
<div class="col-7">
<h1>We'd love to hear from you</h1>
<h5>
Please send us your comments, questions, or feedback.
</h5>
<email address="info@@fakepieshop.com" content="Contact us"></email>
</div>
</div>

View File

@@ -0,0 +1,79 @@
@model Order
<form asp-action="Checkout" method="post" role="form">
<h3 class="my-5">
You're just one step away from your delicious pies.
</h3>
<div asp-validation-summary="All" class="text-danger"></div>
<div class="col-6">
<div class="row g-2">
<div class="col-12">
<label asp-for="FirstName" class="form-label"></label>
<input asp-for="FirstName" class="form-control" />
<span asp-validation-for="FirstName" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="LastName" class="form-label"></label>
<input asp-for="LastName" class="form-control" />
<span asp-validation-for="LastName" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="AddressLine1" class="form-label"></label>
<input asp-for="AddressLine1" class="form-control" />
<span asp-validation-for="AddressLine1" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="AddressLine2" class="form-label"></label>
<input asp-for="AddressLine2" class="form-control" />
<span asp-validation-for="AddressLine2" class="text-danger"></span>
</div>
<div class="col-6">
<label asp-for="City" class="form-label"></label>
<input asp-for="City" class="form-control" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
<div class="col-6">
<label asp-for="State" class="form-label"></label>
<input asp-for="State" class="form-control" />
<span asp-validation-for="State" class="text-danger"></span>
</div>
<div class="col-6">
<label asp-for="ZipCode" class="form-label"></label>
<input asp-for="ZipCode" class="form-control" />
<span asp-validation-for="ZipCode" class="text-danger"></span>
</div>
<div class="col-6">
<label asp-for="Country" class="form-label"></label>
<input asp-for="Country" class="form-control" />
<span asp-validation-for="Country" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="Email" class="form-label"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="PhoneNumber" class="form-label"></label>
<input asp-for="PhoneNumber" class="form-control" />
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
</div>
</div>
<div class="mt-2">
<div class="col-md-offset-2 col-md-5">
<input type="submit" class="btn btn-secondary" value="Complete order" />
</div>
</div>
</div>
</form>

View File

@@ -2,22 +2,21 @@
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" <a class="nav-link dropdown-toggle"
data-toggle="dropdown" data-toggle="dropdown"
href="#" href="#"
role="button" role="button"
data-bs-toggle="dropdown" data-bs-toggle="dropdown"
id="nav-dropdown" id="nav-dropdown"
aria-expanded="false"> aria-expanded="false">
Shop Shop
</a> </a>
<ul class="dropdown-menu" aria-labelledby="nav-dropdown"> <ul class="dropdown-menu" aria-labelledby="nav-dropdown">
@foreach (var category in Model) @foreach (var category in Model)
{ {
<li> <li>
<a class="dropdown-item" <a asp-controller="Pie" asp-action="List"
asp-controller="Pie" asp-route-category="@category.CategoryName"
asp-action="List" class="dropdown-item">
asp-route-category="@category.CategoryName">
@category.CategoryName @category.CategoryName
</a> </a>
</li> </li>

View File

@@ -32,13 +32,11 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" asp-controller="Home" asp-action="Index">Home</a> <a class="nav-link" asp-controller="Home" asp-action="Index">Home</a>
</li> </li>
<vc:category-menu></vc:category-menu>
<vc:shopping-cart-summary></vc:shopping-cart-summary>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" asp-controller="Pie" asp-action="List">Pie List</a>
</li>
<vc:vc:shopping-cart-summary></vc:vc:shopping-cart-summary>
<!-- <li class="nav-item">
<a class="nav-link" asp-controller="Contact" asp-action="Index">Contact</a> <a class="nav-link" asp-controller="Contact" asp-action="Index">Contact</a>
</li> --> </li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@@ -20,6 +20,9 @@
</div> </div>
<hr /> <hr />
<div class="text-center d-grid"> <div class="text-center d-grid">
<a class="btn btn-secondary"
asp-controller="Order"
asp-action="Checkout">Checkout</a>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -3,4 +3,5 @@
@using FakePieShop.Components @using FakePieShop.Components
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, FakePieShop @addTagHelper *, FakePieShop
@addTagHelper FakePieShop.TagHelpers.*, FakePieShop

View File

@@ -16,10 +16,18 @@ build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\mikay\source\repos\FakePieShop\FakePieShop build_property.MSBuildProjectDirectory = C:\Users\mikay\source\repos\FakePieShop\FakePieShop
build_property._RazorSourceGeneratorDebug = build_property._RazorSourceGeneratorDebug =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Contact/Index.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcQ29udGFjdFxJbmRleC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Home/Index.cshtml] [C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Home/Index.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw= build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Order/Checkout.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcT3JkZXJcQ2hlY2tvdXQuY3NodG1s
build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Pie/Details.cshtml] [C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Pie/Details.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcUGllXERldGFpbHMuY3NodG1s build_metadata.AdditionalFiles.TargetPath = Vmlld3NcUGllXERldGFpbHMuY3NodG1s
build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.CssScope =

File diff suppressed because one or more lines are too long

View File

@@ -16,10 +16,18 @@ build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\mikay\source\repos\FakePieShop\FakePieShop build_property.MSBuildProjectDirectory = C:\Users\mikay\source\repos\FakePieShop\FakePieShop
build_property._RazorSourceGeneratorDebug = build_property._RazorSourceGeneratorDebug =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Contact/Index.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcQ29udGFjdFxJbmRleC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Home/Index.cshtml] [C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Home/Index.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw= build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Order/Checkout.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcT3JkZXJcQ2hlY2tvdXQuY3NodG1s
build_metadata.AdditionalFiles.CssScope =
[C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Pie/Details.cshtml] [C:/Users/mikay/source/repos/FakePieShop/FakePieShop/Views/Pie/Details.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcUGllXERldGFpbHMuY3NodG1s build_metadata.AdditionalFiles.TargetPath = Vmlld3NcUGllXERldGFpbHMuY3NodG1s
build_metadata.AdditionalFiles.CssScope = build_metadata.AdditionalFiles.CssScope =