Orders: Detail Query, new field in OrderDetail.. Identity: Validations in Register View, ensure all claims are returned in user end point..pull/49/merge
@ -1,16 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Security.Principal; | |||
using System.Threading.Tasks; | |||
namespace eShopOnContainers.Identity.Extensions | |||
{ | |||
//public static class PrincipalExtensions | |||
//{ | |||
// public static string GetSubjectId(this IPrincipal principal) | |||
// { | |||
// return principal.Identity.GetSubjectId(); | |||
// } | |||
//} | |||
} |
@ -1,10 +0,0 @@ | |||
{ | |||
"Logging": { | |||
"IncludeScopes": false, | |||
"LogLevel": { | |||
"Default": "Debug", | |||
"System": "Information", | |||
"Microsoft": "Information" | |||
} | |||
} | |||
} |
@ -1,4 +1,12 @@ | |||
{ | |||
"ConnectionString": "Server=tcp:127.0.0.1,5434;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", | |||
"IdentityUrl": "http://localhost:5105" | |||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", | |||
"IdentityUrl": "http://identity.service:5105", | |||
"Logging": { | |||
"IncludeScopes": false, | |||
"LogLevel": { | |||
"Default": "Debug", | |||
"System": "Information", | |||
"Microsoft": "Information" | |||
} | |||
} | |||
} |
@ -1,15 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class ExternalLoginConfirmationViewModel | |||
{ | |||
[Required] | |||
[EmailAddress] | |||
public string Email { get; set; } | |||
} | |||
} |
@ -1,15 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class ForgotPasswordViewModel | |||
{ | |||
[Required] | |||
[EmailAddress] | |||
public string Email { get; set; } | |||
} | |||
} |
@ -1,22 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class LoginViewModel | |||
{ | |||
[Required] | |||
[EmailAddress] | |||
public string Email { get; set; } | |||
[Required] | |||
[DataType(DataType.Password)] | |||
public string Password { get; set; } | |||
[Display(Name = "Remember me?")] | |||
public bool RememberMe { get; set; } | |||
} | |||
} |
@ -1,29 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class RegisterViewModel | |||
{ | |||
[Required] | |||
[EmailAddress] | |||
[Display(Name = "Email")] | |||
public string Email { get; set; } | |||
[Required] | |||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} 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; } | |||
public ApplicationUser User { get; set; } | |||
} | |||
} |
@ -1,27 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class ResetPasswordViewModel | |||
{ | |||
[Required] | |||
[EmailAddress] | |||
public string Email { get; set; } | |||
[Required] | |||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] | |||
[DataType(DataType.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; } | |||
public string Code { get; set; } | |||
} | |||
} |
@ -1,19 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using Microsoft.AspNetCore.Mvc.Rendering; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class SendCodeViewModel | |||
{ | |||
public string SelectedProvider { get; set; } | |||
public ICollection<SelectListItem> Providers { get; set; } | |||
public string ReturnUrl { get; set; } | |||
public bool RememberMe { get; set; } | |||
} | |||
} |
@ -1,25 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
{ | |||
public class VerifyCodeViewModel | |||
{ | |||
[Required] | |||
public string Provider { get; set; } | |||
[Required] | |||
public string Code { get; set; } | |||
public string ReturnUrl { get; set; } | |||
[Display(Name = "Remember this browser?")] | |||
public bool RememberBrowser { get; set; } | |||
[Display(Name = "Remember me?")] | |||
public bool RememberMe { get; set; } | |||
} | |||
} |
@ -1,21 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models | |||
{ | |||
public class Address | |||
{ | |||
public Guid Id { get; set; } | |||
public string Street { get; set; } | |||
public string City { get; set; } | |||
public string State { get; set; } | |||
public string StateCode { get; set; } | |||
public string Country { get; set; } | |||
public string CountryCode { get; set; } | |||
public string ZipCode { get; set; } | |||
public double Latitude { get; set; } | |||
public double Longitude { get; set; } | |||
} | |||
} |
@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.Annotations | |||
{ | |||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)] | |||
public class CardExpirationAttribute : ValidationAttribute | |||
{ | |||
public override bool IsValid(object value) | |||
{ | |||
if (value == null) | |||
return false; | |||
var month = value.ToString().Split('/')[0]; | |||
var year = $"20{value.ToString().Split('/')[1]}"; | |||
DateTime d = new DateTime(int.Parse(year), int.Parse(month), 1); | |||
return d > DateTime.UtcNow; | |||
} | |||
} | |||
} |
@ -1,16 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class AddPhoneNumberViewModel | |||
{ | |||
[Required] | |||
[Phone] | |||
[Display(Name = "Phone number")] | |||
public string PhoneNumber { get; set; } | |||
} | |||
} |
@ -1,27 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class ChangePasswordViewModel | |||
{ | |||
[Required] | |||
[DataType(DataType.Password)] | |||
[Display(Name = "Current password")] | |||
public string OldPassword { get; set; } | |||
[Required] | |||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] | |||
[DataType(DataType.Password)] | |||
[Display(Name = "New password")] | |||
public string NewPassword { get; set; } | |||
[DataType(DataType.Password)] | |||
[Display(Name = "Confirm new password")] | |||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] | |||
public string ConfirmPassword { get; set; } | |||
} | |||
} |
@ -1,15 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using Microsoft.AspNetCore.Mvc.Rendering; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class ConfigureTwoFactorViewModel | |||
{ | |||
public string SelectedProvider { get; set; } | |||
public ICollection<SelectListItem> Providers { get; set; } | |||
} | |||
} |
@ -1,12 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class FactorViewModel | |||
{ | |||
public string Purpose { get; set; } | |||
} | |||
} |
@ -1,23 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using Microsoft.AspNetCore.Identity; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class IndexViewModel | |||
{ | |||
public bool HasPassword { get; set; } | |||
public IList<UserLoginInfo> Logins { get; set; } | |||
public string PhoneNumber { get; set; } | |||
public bool TwoFactor { get; set; } | |||
public bool BrowserRemembered { get; set; } | |||
public ApplicationUser User { get; set; } | |||
} | |||
} |
@ -1,16 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using Microsoft.AspNetCore.Http.Authentication; | |||
using Microsoft.AspNetCore.Identity; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class ManageLoginsViewModel | |||
{ | |||
public IList<UserLoginInfo> CurrentLogins { get; set; } | |||
public IList<AuthenticationDescription> OtherLogins { get; set; } | |||
} | |||
} |
@ -1,14 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class RemoveLoginViewModel | |||
{ | |||
public string LoginProvider { get; set; } | |||
public string ProviderKey { get; set; } | |||
} | |||
} |
@ -1,22 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class SetPasswordViewModel | |||
{ | |||
[Required] | |||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] | |||
[DataType(DataType.Password)] | |||
[Display(Name = "New password")] | |||
public string NewPassword { get; set; } | |||
[DataType(DataType.Password)] | |||
[Display(Name = "Confirm new password")] | |||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] | |||
public string ConfirmPassword { get; set; } | |||
} | |||
} |
@ -1,19 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
{ | |||
public class VerifyPhoneNumberViewModel | |||
{ | |||
[Required] | |||
public string Code { get; set; } | |||
[Required] | |||
[Phone] | |||
[Display(Name = "Phone number")] | |||
public string PhoneNumber { get; set; } | |||
} | |||
} |
@ -1,40 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models | |||
{ | |||
public class OrderRequest | |||
{ | |||
public OrderRequest() { | |||
Items = new List<OrderRequestItem>(); | |||
} | |||
public string City { get; set; } | |||
public string Street { get; set; } | |||
public string State { get; set; } | |||
public string Country { get; set; } | |||
public string ZipCode { get; set; } | |||
public string CardNumber { get; set; } | |||
public string CardHolderName { get; set; } | |||
public DateTime CardExpiration { get; set; } | |||
public string CardSecurityNumber { get; set; } | |||
public int CardTypeId { get; set; } | |||
public string Buyer { get; set; } | |||
public List<OrderRequestItem> Items { get; } | |||
} | |||
} |
@ -1,20 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models | |||
{ | |||
public class OrderRequestItem | |||
{ | |||
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; } | |||
} | |||
} |
@ -1,12 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models.OrderViewModels | |||
{ | |||
public class CreateOrderViewModel | |||
{ | |||
public Order Order { get; set; } | |||
} | |||
} |
@ -1,25 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
namespace Microsoft.eShopOnContainers.WebMVC.Models | |||
{ | |||
public class PaymentInfo | |||
{ | |||
public Guid Id { get; set; } | |||
public string CardNumber {get;set;} | |||
public string SecurityNumber { get; set; } | |||
public int ExpirationMonth { get; set; } //CCE: I would simplify with a string Expiration field so I guess we are not going to validate with real data. It's a demo.. | |||
public int ExpirationYear { get; set; } //CCE: Idem. | |||
public string CardHolderName { get; set; } | |||
public CardType CardType { get; set; } //CCE: Discuss with team if this is needed for a demo. | |||
public string Expiration { get; set; } //CCE: Added to simplify.. | |||
} | |||
public enum CardType:int | |||
{ | |||
AMEX, | |||
VISA | |||
} | |||
} |
@ -0,0 +1,73 @@ | |||
@model Microsoft.eShopOnContainers.WebMVC.Models.Order | |||
<div class="col-md-12"> | |||
<section> | |||
<table class="table"> | |||
<thead> | |||
<tr> | |||
<th class="cart-product-column"> | |||
PRODUCT | |||
</th> | |||
<th> | |||
</th> | |||
<th> | |||
BRAND | |||
</th> | |||
<th> | |||
PRICE | |||
</th> | |||
<th> | |||
QUANTITY | |||
</th> | |||
<th> | |||
COST | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
@for (int i = 0; i < Model.OrderItems.Count; i++) | |||
{ | |||
var item = Model.OrderItems[i]; | |||
<tr> | |||
<td class="cart-product-column"> | |||
<img class="cart-product-image" src="@item.PictureUrl" /> | |||
<input type="hidden" value="@item.PictureUrl" name=@("orderitems[" + i + "].PictureUrl") /> | |||
</td> | |||
<td class="cart-product-column"> | |||
<span class="cart-product-column-name">@item.ProductName</span> | |||
<input type="hidden" value="@item.ProductName" name=@("orderitems[" + i + "].ProductName") /> | |||
</td> | |||
<td class="cart-product-column">ROSLYN</td> | |||
<td class="cart-product-column">$ @item.UnitPrice | |||
<input type="hidden" value="@item.UnitPrice" name=@("orderitems[" + i + "].UnitPrice") /> | |||
</td> | |||
<td class="cart-product-column">@item.Units | |||
<input type="hidden" value="@item.Units" name=@("orderitems[" + i + "].Units") /> | |||
</td> | |||
<td class="cart-product-column cart-total-value">$ @Math.Round(item.Units * item.UnitPrice, 2)</td> | |||
</tr> | |||
} | |||
<tr class="cart-totals"> | |||
<td></td> | |||
<td></td> | |||
<td></td> | |||
<td></td> | |||
<td> | |||
<input type="submit" | |||
class="btn btn-default cart-refresh-button" | |||
value="" | |||
name="action" /> | |||
</td> | |||
<td> | |||
<div class="cart-total-value"> | |||
<div class="cart-total-label"><span>TOTAL</span></div> | |||
<span>$ @Model.Total</span> | |||
</div> | |||
</td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
</section> | |||
</div> |
@ -1,7 +1,5 @@ | |||
@using Microsoft.eShopOnContainers.WebMVC | |||
@using Microsoft.eShopOnContainers.WebMVC.Models | |||
@using Microsoft.eShopOnContainers.WebMVC.Models.AccountViewModels | |||
@using Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels | |||
@using Microsoft.AspNetCore.Identity | |||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |