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:
Steve Smith
2017-10-23 09:23:57 -04:00
committed by GitHub
parent 0eb4d72b89
commit dea73a5f5e
155 changed files with 29464 additions and 40 deletions

View File

@@ -0,0 +1,7 @@
namespace Microsoft.eShopWeb.RazorPages.ViewModels
{
public class BasketComponentViewModel
{
public int ItemsCount { get; set; }
}
}

View 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; }
}
}

View 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);
}
}
}

View 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; }
}
}

View 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; }
}
}

View 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; }
}
}

View 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>();
}
}

View 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; }
}
}

View 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; }
}
}