Adding Razor Pages Version (#60)
* In progress copying code into new RP project Cleaning up namespaces and whitespace in original Web project * Cleaning up some more namespaces * Removing unused page. * Index page loads correctly. * Fixing up paging. * Moving views; getting ready to convert to RPs * Auto stash before merge of "master" and "origin/master" Basket and Checkout pages wired up * WIP on Account pages * Working on signin/signout * Working on auth * Getting order history working Fixing auth bug * Fixing Checkout issue * Fixing link
This commit is contained in:
7
src/WebRazorPages/ViewModels/BasketComponentViewModel.cs
Normal file
7
src/WebRazorPages/ViewModels/BasketComponentViewModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class BasketComponentViewModel
|
||||
{
|
||||
public int ItemsCount { get; set; }
|
||||
}
|
||||
}
|
||||
14
src/WebRazorPages/ViewModels/BasketItemViewModel.cs
Normal file
14
src/WebRazorPages/ViewModels/BasketItemViewModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
|
||||
public class BasketItemViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CatalogItemId { get; set; }
|
||||
public string ProductName { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
public decimal OldUnitPrice { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
public string PictureUrl { get; set; }
|
||||
}
|
||||
}
|
||||
19
src/WebRazorPages/ViewModels/BasketViewModel.cs
Normal file
19
src/WebRazorPages/ViewModels/BasketViewModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
|
||||
public class BasketViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public List<BasketItemViewModel> Items { get; set; } = new List<BasketItemViewModel>();
|
||||
public string BuyerId { get; set; }
|
||||
|
||||
public decimal Total()
|
||||
{
|
||||
return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/WebRazorPages/ViewModels/CatalogIndexViewModel.cs
Normal file
15
src/WebRazorPages/ViewModels/CatalogIndexViewModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class CatalogIndexViewModel
|
||||
{
|
||||
public IEnumerable<CatalogItemViewModel> CatalogItems { get; set; }
|
||||
public IEnumerable<SelectListItem> Brands { get; set; }
|
||||
public IEnumerable<SelectListItem> Types { get; set; }
|
||||
public int? BrandFilterApplied { get; set; }
|
||||
public int? TypesFilterApplied { get; set; }
|
||||
public PaginationInfoViewModel PaginationInfo { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/WebRazorPages/ViewModels/CatalogItemViewModel.cs
Normal file
11
src/WebRazorPages/ViewModels/CatalogItemViewModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
|
||||
public class CatalogItemViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PictureUri { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/WebRazorPages/ViewModels/OrderItemViewModel.cs
Normal file
18
src/WebRazorPages/ViewModels/OrderItemViewModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class OrderItemViewModel
|
||||
{
|
||||
public int ProductId { get; set; }
|
||||
|
||||
public string ProductName { get; set; }
|
||||
|
||||
public decimal UnitPrice { get; set; }
|
||||
|
||||
public decimal Discount { get; set; }
|
||||
|
||||
public int Units { get; set; }
|
||||
|
||||
public string PictureUrl { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
18
src/WebRazorPages/ViewModels/OrderViewModel.cs
Normal file
18
src/WebRazorPages/ViewModels/OrderViewModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using ApplicationCore.Entities.OrderAggregate;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class OrderViewModel
|
||||
{
|
||||
public int OrderNumber { get; set; }
|
||||
public DateTimeOffset OrderDate { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
public string Status { get; set; }
|
||||
|
||||
public Address ShippingAddress { get; set; }
|
||||
|
||||
public List<OrderItemViewModel> OrderItems { get; set; } = new List<OrderItemViewModel>();
|
||||
}
|
||||
}
|
||||
12
src/WebRazorPages/ViewModels/PaginationInfoViewModel.cs
Normal file
12
src/WebRazorPages/ViewModels/PaginationInfoViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class PaginationInfoViewModel
|
||||
{
|
||||
public int TotalItems { get; set; }
|
||||
public int ItemsPerPage { get; set; }
|
||||
public int ActualPage { get; set; }
|
||||
public int TotalPages { get; set; }
|
||||
public string Previous { get; set; }
|
||||
public string Next { get; set; }
|
||||
}
|
||||
}
|
||||
24
src/WebRazorPages/ViewModels/RegisterViewModel.cs
Normal file
24
src/WebRazorPages/ViewModels/RegisterViewModel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Microsoft.eShopWeb.RazorPages.ViewModels
|
||||
{
|
||||
public class RegisterViewModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user