Merge branch 'Dev' of https://github.com/dotnet/eShopOnContainers into Dev
This commit is contained in:
commit
64e11dd94d
@ -19,21 +19,15 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
{
|
{
|
||||||
private readonly UserManager<ApplicationUser> _userManager;
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||||
private readonly IEmailSender _emailSender;
|
|
||||||
private readonly ISmsSender _smsSender;
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public AccountController(
|
public AccountController(
|
||||||
UserManager<ApplicationUser> userManager,
|
UserManager<ApplicationUser> userManager,
|
||||||
SignInManager<ApplicationUser> signInManager,
|
SignInManager<ApplicationUser> signInManager,
|
||||||
IEmailSender emailSender,
|
|
||||||
ISmsSender smsSender,
|
|
||||||
ILoggerFactory loggerFactory)
|
ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_signInManager = signInManager;
|
_signInManager = signInManager;
|
||||||
_emailSender = emailSender;
|
|
||||||
_smsSender = smsSender;
|
|
||||||
_logger = loggerFactory.CreateLogger<AccountController>();
|
_logger = loggerFactory.CreateLogger<AccountController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +145,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
{
|
{
|
||||||
await _signInManager.SignOutAsync();
|
await _signInManager.SignOutAsync();
|
||||||
_logger.LogInformation(4, "User logged out.");
|
_logger.LogInformation(4, "User logged out.");
|
||||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
return RedirectToAction(nameof(CatalogController.Index), "Catalog");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -368,44 +362,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
|
return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe });
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Account/SendCode
|
|
||||||
[HttpPost]
|
|
||||||
[AllowAnonymous]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> SendCode(SendCodeViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate the token and send it
|
|
||||||
var code = await _userManager.GenerateTwoFactorTokenAsync(user, model.SelectedProvider);
|
|
||||||
if (string.IsNullOrWhiteSpace(code))
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
var message = "Your security code is: " + code;
|
|
||||||
if (model.SelectedProvider == "Email")
|
|
||||||
{
|
|
||||||
await _emailSender.SendEmailAsync(await _userManager.GetEmailAsync(user), "Security Code", message);
|
|
||||||
}
|
|
||||||
else if (model.SelectedProvider == "Phone")
|
|
||||||
{
|
|
||||||
await _smsSender.SendSmsAsync(await _userManager.GetPhoneNumberAsync(user), message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return RedirectToAction(nameof(VerifyCode), new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /Account/VerifyCode
|
// GET: /Account/VerifyCode
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -476,7 +432,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
return RedirectToAction(nameof(CatalogController.Index), "Catalog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
69
src/Web/WebMVC/Controllers/CartController.cs
Normal file
69
src/Web/WebMVC/Controllers/CartController.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
public class CartController : Controller
|
||||||
|
{
|
||||||
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
|
private readonly IBasketService _basketSvc;
|
||||||
|
private readonly ICatalogService _catalogSvc;
|
||||||
|
|
||||||
|
public CartController(IBasketService basketSvc, ICatalogService catalogSvc, UserManager<ApplicationUser> userManager)
|
||||||
|
{
|
||||||
|
_userManager = userManager;
|
||||||
|
_basketSvc = basketSvc;
|
||||||
|
_catalogSvc = catalogSvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> Index()
|
||||||
|
{
|
||||||
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
var vm = _basketSvc.GetBasket(user);
|
||||||
|
|
||||||
|
return View(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Index(Dictionary<string, int> quantities, string action)
|
||||||
|
{
|
||||||
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
var basket = _basketSvc.SetQuantities(user, quantities);
|
||||||
|
var vm = _basketSvc.UpdateBasket(basket);
|
||||||
|
|
||||||
|
if (action == "[ Checkout ]")
|
||||||
|
{
|
||||||
|
var order = _basketSvc.MapBasketToOrder(basket);
|
||||||
|
return RedirectToAction("Create", "Order");
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> AddToCart(string productId)
|
||||||
|
{
|
||||||
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
var productDetails = _catalogSvc.GetCatalogItem(productId);
|
||||||
|
var product = new BasketItem()
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
Quantity = 1,
|
||||||
|
ProductName = productDetails.Name,
|
||||||
|
PictureUrl = productDetails.PictureUrl,
|
||||||
|
UnitPrice = productDetails.Price,
|
||||||
|
ProductId = productId
|
||||||
|
};
|
||||||
|
_basketSvc.AddItemToBasket(user, product);
|
||||||
|
return RedirectToAction("Index", "Catalog");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
src/Web/WebMVC/Controllers/CatalogController.cs
Normal file
55
src/Web/WebMVC/Controllers/CatalogController.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Net.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels;
|
||||||
|
using BikeSharing_Private_Web_Site.Services.Pagination;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||||
|
{
|
||||||
|
public class CatalogController : Controller
|
||||||
|
{
|
||||||
|
private ICatalogService _catalogSvc;
|
||||||
|
|
||||||
|
public CatalogController(ICatalogService catalogSvc)
|
||||||
|
{
|
||||||
|
_catalogSvc = catalogSvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page)
|
||||||
|
{
|
||||||
|
var vm = new IndexViewModel()
|
||||||
|
{
|
||||||
|
CatalogItems = await _catalogSvc.GetCatalogItems(6 * (page ?? 0), 6),
|
||||||
|
Brands = _catalogSvc.GetBrands(),
|
||||||
|
Types = _catalogSvc.GetTypes(),
|
||||||
|
BrandFilterApplied = BrandFilterApplied ?? 0,
|
||||||
|
TypesFilterApplied = TypesFilterApplied ?? 0,
|
||||||
|
PaginationInfo = new PaginationInfo()
|
||||||
|
{
|
||||||
|
ActualPage = page ?? 0,
|
||||||
|
ItemsPerPage = 6,
|
||||||
|
TotalItems = _catalogSvc.TotalItems,
|
||||||
|
TotalPages = int.Parse(Math.Round(((decimal)_catalogSvc.TotalItems / 6), MidpointRounding.AwayFromZero).ToString())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.PaginationInfo.Next = (vm.PaginationInfo.ActualPage == vm.PaginationInfo.TotalPages - 1) ? "is-disabled" : "";
|
||||||
|
vm.PaginationInfo.Previous = (vm.PaginationInfo.ActualPage == 0) ? "is-disabled" : "";
|
||||||
|
|
||||||
|
return View(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Net.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
private HttpClient _http;
|
|
||||||
private AppSettings _settings;
|
|
||||||
private ICatalogService _catalogSvc;
|
|
||||||
|
|
||||||
public HomeController(IOptions<AppSettings> options, ICatalogService catalogSvc)
|
|
||||||
{
|
|
||||||
_http = new HttpClient();
|
|
||||||
_settings = options.Value;
|
|
||||||
_catalogSvc = catalogSvc;
|
|
||||||
}
|
|
||||||
public async Task<IActionResult> Index()
|
|
||||||
{
|
|
||||||
//var dataString = await _http.GetStringAsync(_settings.CatalogUrl);
|
|
||||||
//var items = JsonConvert.DeserializeObject<List<CatalogItem>>(dataString);
|
|
||||||
//items.AddRange(items);
|
|
||||||
var items = await _catalogSvc.GetCatalogItems();
|
|
||||||
var vm = new IndexViewModel()
|
|
||||||
{
|
|
||||||
CatalogItems = items
|
|
||||||
};
|
|
||||||
return View(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IActionResult> Orders()
|
|
||||||
{
|
|
||||||
ViewData["Message"] = "Orders page.";
|
|
||||||
|
|
||||||
var ordersUrl = _settings.OrderingUrl + "/api/ordering/orders";
|
|
||||||
var dataString = await _http.GetStringAsync(ordersUrl);
|
|
||||||
var items = JsonConvert.DeserializeObject<List<Order>>(dataString);
|
|
||||||
return View(items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult Error()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,395 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models.ManageViewModels;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
[Authorize]
|
|
||||||
public class ManageController : Controller
|
|
||||||
{
|
|
||||||
private readonly UserManager<ApplicationUser> _userManager;
|
|
||||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
|
||||||
private readonly IEmailSender _emailSender;
|
|
||||||
private readonly ISmsSender _smsSender;
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public ManageController(
|
|
||||||
UserManager<ApplicationUser> userManager,
|
|
||||||
SignInManager<ApplicationUser> signInManager,
|
|
||||||
IEmailSender emailSender,
|
|
||||||
ISmsSender smsSender,
|
|
||||||
ILoggerFactory loggerFactory)
|
|
||||||
{
|
|
||||||
_userManager = userManager;
|
|
||||||
_signInManager = signInManager;
|
|
||||||
_emailSender = emailSender;
|
|
||||||
_smsSender = smsSender;
|
|
||||||
_logger = loggerFactory.CreateLogger<ManageController>();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/Index
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<IActionResult> Index(ManageMessageId? message = null)
|
|
||||||
{
|
|
||||||
ViewData["StatusMessage"] =
|
|
||||||
message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
|
|
||||||
: message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
|
|
||||||
: message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
|
|
||||||
: message == ManageMessageId.Error ? "An error has occurred."
|
|
||||||
: message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
|
|
||||||
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
|
|
||||||
: "";
|
|
||||||
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
var model = new IndexViewModel
|
|
||||||
{
|
|
||||||
HasPassword = await _userManager.HasPasswordAsync(user),
|
|
||||||
PhoneNumber = await _userManager.GetPhoneNumberAsync(user),
|
|
||||||
TwoFactor = await _userManager.GetTwoFactorEnabledAsync(user),
|
|
||||||
Logins = await _userManager.GetLoginsAsync(user),
|
|
||||||
BrowserRemembered = await _signInManager.IsTwoFactorClientRememberedAsync(user),
|
|
||||||
User = user
|
|
||||||
};
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> Index(IndexViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = await _userManager.GetUserAsync(HttpContext.User);
|
|
||||||
|
|
||||||
user.CardHolderName = model.User.CardHolderName;
|
|
||||||
user.CardNumber = model.User.CardNumber;
|
|
||||||
//user.CardType = model.User.CardType;
|
|
||||||
user.City = model.User.City;
|
|
||||||
user.Country = model.User.Country;
|
|
||||||
user.Expiration = model.User.Expiration;
|
|
||||||
user.State = model.User.State;
|
|
||||||
user.Street = model.User.Street;
|
|
||||||
user.ZipCode = model.User.ZipCode;
|
|
||||||
|
|
||||||
var result = await _userManager.UpdateAsync(user);
|
|
||||||
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
_logger.LogInformation(99, "User changed his address and payment method information.");
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.ProfileUpdated });
|
|
||||||
}
|
|
||||||
|
|
||||||
AddErrors(result);
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/RemoveLogin
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> RemoveLogin(RemoveLoginViewModel account)
|
|
||||||
{
|
|
||||||
ManageMessageId? message = ManageMessageId.Error;
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
var result = await _userManager.RemoveLoginAsync(user, account.LoginProvider, account.ProviderKey);
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
message = ManageMessageId.RemoveLoginSuccess;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(ManageLogins), new { Message = message });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/AddPhoneNumber
|
|
||||||
public IActionResult AddPhoneNumber()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/AddPhoneNumber
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> AddPhoneNumber(AddPhoneNumberViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
// Generate the token and send it
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
|
|
||||||
await _smsSender.SendSmsAsync(model.PhoneNumber, "Your security code is: " + code);
|
|
||||||
return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/EnableTwoFactorAuthentication
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> EnableTwoFactorAuthentication()
|
|
||||||
{
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
await _userManager.SetTwoFactorEnabledAsync(user, true);
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
_logger.LogInformation(1, "User enabled two-factor authentication.");
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(Index), "Manage");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/DisableTwoFactorAuthentication
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> DisableTwoFactorAuthentication()
|
|
||||||
{
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
await _userManager.SetTwoFactorEnabledAsync(user, false);
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
_logger.LogInformation(2, "User disabled two-factor authentication.");
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(Index), "Manage");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/VerifyPhoneNumber
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<IActionResult> VerifyPhoneNumber(string phoneNumber)
|
|
||||||
{
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, phoneNumber);
|
|
||||||
// Send an SMS to verify the phone number
|
|
||||||
return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/VerifyPhoneNumber
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> VerifyPhoneNumber(VerifyPhoneNumberViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
var result = await _userManager.ChangePhoneNumberAsync(user, model.PhoneNumber, model.Code);
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.AddPhoneSuccess });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we got this far, something failed, redisplay the form
|
|
||||||
ModelState.AddModelError(string.Empty, "Failed to verify phone number");
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/RemovePhoneNumber
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> RemovePhoneNumber()
|
|
||||||
{
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
var result = await _userManager.SetPhoneNumberAsync(user, null);
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.RemovePhoneSuccess });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/ChangePassword
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult ChangePassword()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/ChangePassword
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> ChangePassword(ChangePasswordViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
var result = await _userManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword);
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
_logger.LogInformation(3, "User changed their password successfully.");
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.ChangePasswordSuccess });
|
|
||||||
}
|
|
||||||
AddErrors(result);
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/SetPassword
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult SetPassword()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/SetPassword
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public async Task<IActionResult> SetPassword(SetPasswordViewModel model)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
var result = await _userManager.AddPasswordAsync(user, model.NewPassword);
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
await _signInManager.SignInAsync(user, isPersistent: false);
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.SetPasswordSuccess });
|
|
||||||
}
|
|
||||||
AddErrors(result);
|
|
||||||
return View(model);
|
|
||||||
}
|
|
||||||
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
|
|
||||||
}
|
|
||||||
|
|
||||||
//GET: /Manage/ManageLogins
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<IActionResult> ManageLogins(ManageMessageId? message = null)
|
|
||||||
{
|
|
||||||
ViewData["StatusMessage"] =
|
|
||||||
message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
|
|
||||||
: message == ManageMessageId.AddLoginSuccess ? "The external login was added."
|
|
||||||
: message == ManageMessageId.Error ? "An error has occurred."
|
|
||||||
: "";
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
var userLogins = await _userManager.GetLoginsAsync(user);
|
|
||||||
var otherLogins = _signInManager.GetExternalAuthenticationSchemes().Where(auth => userLogins.All(ul => auth.AuthenticationScheme != ul.LoginProvider)).ToList();
|
|
||||||
ViewData["ShowRemoveButton"] = user.PasswordHash != null || userLogins.Count > 1;
|
|
||||||
return View(new ManageLoginsViewModel
|
|
||||||
{
|
|
||||||
CurrentLogins = userLogins,
|
|
||||||
OtherLogins = otherLogins
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Manage/LinkLogin
|
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
public IActionResult LinkLogin(string provider)
|
|
||||||
{
|
|
||||||
// Request a redirect to the external login provider to link a login for the current user
|
|
||||||
var redirectUrl = Url.Action("LinkLoginCallback", "Manage");
|
|
||||||
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User));
|
|
||||||
return Challenge(properties, provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Manage/LinkLoginCallback
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<ActionResult> LinkLoginCallback()
|
|
||||||
{
|
|
||||||
var user = await GetCurrentUserAsync();
|
|
||||||
if (user == null)
|
|
||||||
{
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
var info = await _signInManager.GetExternalLoginInfoAsync(await _userManager.GetUserIdAsync(user));
|
|
||||||
if (info == null)
|
|
||||||
{
|
|
||||||
return RedirectToAction(nameof(ManageLogins), new { Message = ManageMessageId.Error });
|
|
||||||
}
|
|
||||||
var result = await _userManager.AddLoginAsync(user, info);
|
|
||||||
var message = result.Succeeded ? ManageMessageId.AddLoginSuccess : ManageMessageId.Error;
|
|
||||||
return RedirectToAction(nameof(ManageLogins), new { Message = message });
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Helpers
|
|
||||||
|
|
||||||
private void AddErrors(IdentityResult result)
|
|
||||||
{
|
|
||||||
foreach (var error in result.Errors)
|
|
||||||
{
|
|
||||||
ModelState.AddModelError(string.Empty, error.Description);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ManageMessageId
|
|
||||||
{
|
|
||||||
AddPhoneSuccess,
|
|
||||||
AddLoginSuccess,
|
|
||||||
ChangePasswordSuccess,
|
|
||||||
SetTwoFactorSuccess,
|
|
||||||
SetPasswordSuccess,
|
|
||||||
RemoveLoginSuccess,
|
|
||||||
RemovePhoneSuccess,
|
|
||||||
Error,
|
|
||||||
ProfileUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task<ApplicationUser> GetCurrentUserAsync()
|
|
||||||
{
|
|
||||||
return _userManager.GetUserAsync(HttpContext.User);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,31 +5,66 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models.OrderViewModels;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||||
{
|
{
|
||||||
|
[Authorize]
|
||||||
public class OrderController : Controller
|
public class OrderController : Controller
|
||||||
{
|
{
|
||||||
private IOrderingService _orderSvc;
|
private IOrderingService _orderSvc;
|
||||||
public OrderController(IOrderingService orderSvc)
|
private IBasketService _basketSvc;
|
||||||
|
private readonly UserManager<ApplicationUser> _userManager;
|
||||||
|
public OrderController(IOrderingService orderSvc, IBasketService basketSvc, UserManager<ApplicationUser> userManager)
|
||||||
{
|
{
|
||||||
|
_userManager = userManager;
|
||||||
_orderSvc = orderSvc;
|
_orderSvc = orderSvc;
|
||||||
|
_basketSvc = basketSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Cart()
|
public async Task<IActionResult> Create()
|
||||||
{
|
{
|
||||||
return View();
|
var vm = new CreateOrderViewModel();
|
||||||
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
var basket = _basketSvc.GetBasket(user);
|
||||||
|
var order = _basketSvc.MapBasketToOrder(basket);
|
||||||
|
vm.Order = _orderSvc.MapUserInfoIntoOrder(user, order);
|
||||||
|
|
||||||
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Create()
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Create(CreateOrderViewModel model)
|
||||||
{
|
{
|
||||||
return View();
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
var basket = _basketSvc.GetBasket(user);
|
||||||
|
var order = _basketSvc.MapBasketToOrder(basket);
|
||||||
|
|
||||||
|
// override if user has changed some shipping address or payment info data.
|
||||||
|
_orderSvc.OverrideUserInfoIntoOrder(model.Order, order);
|
||||||
|
_orderSvc.CreateOrder(user, order);
|
||||||
|
|
||||||
|
//Empty basket for current user.
|
||||||
|
_basketSvc.CleanBasket(user);
|
||||||
|
|
||||||
|
//Redirect to historic list.
|
||||||
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index(Order item)
|
public async Task<IActionResult> Detail(string orderId)
|
||||||
{
|
{
|
||||||
_orderSvc.AddOrder(item);
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
return View(_orderSvc.GetOrders());
|
var order = _orderSvc.GetOrder(user, orderId);
|
||||||
|
|
||||||
|
return View(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> Index(Order item)
|
||||||
|
{
|
||||||
|
var user = await _userManager.GetUserAsync(HttpContext.User);
|
||||||
|
return View(_orderSvc.GetMyOrders(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
23
src/Web/WebMVC/Extensions/SessionExtensions.cs
Normal file
23
src/Web/WebMVC/Extensions/SessionExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
public static class SessionExtensions
|
||||||
|
{
|
||||||
|
public static void SetObject(this ISession session, string key, object value)
|
||||||
|
{
|
||||||
|
session.SetString(key, JsonConvert.SerializeObject(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetObject<T>(this ISession session, string key)
|
||||||
|
{
|
||||||
|
var value = session.GetString(key);
|
||||||
|
|
||||||
|
return value == null ? default(T) : JsonConvert.DeserializeObject<T>(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
public class Address
|
public class Address
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Street { get; set; }
|
public string Street { get; set; }
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
public string State { get; set; }
|
public string State { get; set; }
|
||||||
public string StateCode { get; set; }
|
public string StateCode { get; set; }
|
||||||
|
24
src/Web/WebMVC/Models/Basket.cs
Normal file
24
src/Web/WebMVC/Models/Basket.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
{
|
||||||
|
public class Basket
|
||||||
|
{
|
||||||
|
public Basket()
|
||||||
|
{
|
||||||
|
Items = new List<BasketItem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id;
|
||||||
|
public List<BasketItem> Items { get; set; }
|
||||||
|
public string BuyerId { get; set; }
|
||||||
|
|
||||||
|
public decimal Total()
|
||||||
|
{
|
||||||
|
return Items.Sum(x => x.UnitPrice * x.Quantity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
src/Web/WebMVC/Models/BasketItem.cs
Normal file
17
src/Web/WebMVC/Models/BasketItem.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
{
|
||||||
|
public class BasketItem
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string ProductId { get; set; }
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
public decimal UnitPrice { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -4,9 +4,10 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
{
|
{
|
||||||
public class CatalogItem
|
public class CatalogItem
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using BikeSharing_Private_Web_Site.Services.Pagination;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels
|
||||||
{
|
{
|
||||||
public class IndexViewModel
|
public class IndexViewModel
|
||||||
{
|
{
|
||||||
@ -13,5 +14,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels
|
|||||||
public IEnumerable<SelectListItem> Types { get; set; }
|
public IEnumerable<SelectListItem> Types { get; set; }
|
||||||
public int BrandFilterApplied { get; set; }
|
public int BrandFilterApplied { get; set; }
|
||||||
public int TypesFilterApplied { get; set; }
|
public int TypesFilterApplied { get; set; }
|
||||||
|
public PaginationInfo PaginationInfo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -7,7 +8,14 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
{
|
{
|
||||||
public class Order
|
public class Order
|
||||||
{
|
{
|
||||||
Guid Id;
|
public Order()
|
||||||
|
{
|
||||||
|
OrderItems = new List<OrderItem>();
|
||||||
|
ShippingAddress = new Address();
|
||||||
|
PaymentInfo = new PaymentInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id;
|
||||||
public List<OrderItem> OrderItems { get; set; }
|
public List<OrderItem> OrderItems { get; set; }
|
||||||
public string OrderNumber
|
public string OrderNumber
|
||||||
{
|
{
|
||||||
@ -17,12 +25,23 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int SequenceNumber { get; set; }
|
public int SequenceNumber { get; set; }
|
||||||
public virtual Guid BuyerId { get; set; }
|
public virtual string BuyerId { get; set; }
|
||||||
public virtual Address ShippingAddress { get; set; }
|
public virtual Address ShippingAddress { get; set; }
|
||||||
|
public virtual PaymentInfo PaymentInfo { get; set; }
|
||||||
public virtual DateTime OrderDate { get; set; }
|
public virtual DateTime OrderDate { get; set; }
|
||||||
|
public OrderState State { get; set; }
|
||||||
|
|
||||||
|
public decimal Total() {
|
||||||
|
return OrderItems.Sum(x => x.Quantity * x.UnitPrice);
|
||||||
|
}
|
||||||
|
|
||||||
//(CCE) public virtual Address BillingAddress { get; set; }
|
//(CCE) public virtual Address BillingAddress { get; set; }
|
||||||
//(CDLTLL) public virtual OrderStatus Status { get; set; }
|
//(CDLTLL) public virtual OrderStatus Status { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum OrderState:int
|
||||||
|
{
|
||||||
|
InProcess = 0,
|
||||||
|
Delivered = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,14 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
{
|
{
|
||||||
public class OrderItem
|
public class OrderItem
|
||||||
{
|
{
|
||||||
Guid Id;
|
public string Id;
|
||||||
public Guid ProductId { get; set; }
|
public string ProductId { get; set; }
|
||||||
public Guid OrderId { get; set; }
|
public string OrderId { get; set; }
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
public decimal Discount { get; set; }
|
public decimal Discount { get; set; }
|
||||||
|
public string PictureUrl { get; set; }
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("Product Id: {0}, Quantity: {1}", this.Id, this.Quantity);
|
return String.Format("Product Id: {0}, Quantity: {1}", this.Id, this.Quantity);
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
17
src/Web/WebMVC/Models/Pagination/PaginationInfo.cs
Normal file
17
src/Web/WebMVC/Models/Pagination/PaginationInfo.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BikeSharing_Private_Web_Site.Services.Pagination
|
||||||
|
{
|
||||||
|
public class PaginationInfo
|
||||||
|
{
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
@ -10,10 +10,11 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
|
|||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string CardNumber {get;set;}
|
public string CardNumber {get;set;}
|
||||||
public string SecurityNumber { get; set; }
|
public string SecurityNumber { get; set; }
|
||||||
public int ExpirationMonth { 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; }
|
public int ExpirationYear { get; set; } //CCE: Idem.
|
||||||
public string CardHolderName { get; set; }
|
public string CardHolderName { get; set; }
|
||||||
public CardType CardType { 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
|
public enum CardType:int
|
||||||
|
98
src/Web/WebMVC/Services/BasketService.cs
Normal file
98
src/Web/WebMVC/Services/BasketService.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
||||||
|
{
|
||||||
|
public class BasketService : IBasketService
|
||||||
|
{
|
||||||
|
private int _itemsInCart;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
public BasketService(IHttpContextAccessor httpContextAccessor)
|
||||||
|
{
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ItemsInCart { get { return _itemsInCart; }}
|
||||||
|
|
||||||
|
public Basket GetBasket(ApplicationUser user)
|
||||||
|
{
|
||||||
|
Basket activeOrder;
|
||||||
|
activeOrder = _httpContextAccessor.HttpContext.Session.GetObject<Basket>("MyActiveOrder");
|
||||||
|
_itemsInCart = (activeOrder != null) ? activeOrder.Items.Count() : 0;
|
||||||
|
|
||||||
|
return activeOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Basket UpdateBasket(Basket basket)
|
||||||
|
{
|
||||||
|
_httpContextAccessor.HttpContext.Session.SetObject("MyActiveOrder", basket);
|
||||||
|
return _httpContextAccessor.HttpContext.Session.GetObject<Basket>("MyActiveOrder");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Basket SetQuantities(ApplicationUser user, Dictionary<string, int> quantities)
|
||||||
|
{
|
||||||
|
var basket = GetBasket(user);
|
||||||
|
|
||||||
|
basket.Items.ForEach(x =>
|
||||||
|
{
|
||||||
|
var quantity = quantities.Where(y => y.Key == x.Id).FirstOrDefault();
|
||||||
|
if (quantities.Where(y => y.Key == x.Id).Count() > 0)
|
||||||
|
x.Quantity = quantity.Value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return basket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Order MapBasketToOrder(Basket basket)
|
||||||
|
{
|
||||||
|
var order = new Order()
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
BuyerId = basket.BuyerId
|
||||||
|
};
|
||||||
|
|
||||||
|
basket.Items.ForEach(x =>
|
||||||
|
{
|
||||||
|
order.OrderItems.Add(new OrderItem()
|
||||||
|
{
|
||||||
|
ProductId = x.ProductId,
|
||||||
|
OrderId = order.Id,
|
||||||
|
PictureUrl = x.PictureUrl,
|
||||||
|
ProductName = x.ProductName,
|
||||||
|
Quantity = x.Quantity,
|
||||||
|
UnitPrice = x.UnitPrice
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddItemToBasket(ApplicationUser user, BasketItem product)
|
||||||
|
{
|
||||||
|
Basket activeOrder = GetBasket(user);
|
||||||
|
if (activeOrder == null)
|
||||||
|
{
|
||||||
|
activeOrder = new Basket()
|
||||||
|
{
|
||||||
|
BuyerId = user.Id,
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
Items = new List<Models.BasketItem>()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
activeOrder.Items.Add(product);
|
||||||
|
//CCE: lacks and httpcall to persist in the real back.end service.
|
||||||
|
_httpContextAccessor.HttpContext.Session.SetObject("MyActiveOrder", activeOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CleanBasket(ApplicationUser user)
|
||||||
|
{
|
||||||
|
_httpContextAccessor.HttpContext.Session.SetObject("MyActiveOrder", new Basket());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,41 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public class CartService : ICartService
|
|
||||||
{
|
|
||||||
Order _order;
|
|
||||||
|
|
||||||
public CartService()
|
|
||||||
{
|
|
||||||
_order = new Order();
|
|
||||||
_order.OrderItems = new System.Collections.Generic.List<OrderItem>();
|
|
||||||
_order.OrderItems.Add(new OrderItem()
|
|
||||||
{
|
|
||||||
ProductName = "Cart product"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddItemToOrder(CatalogItem item)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetItemCountFromOrderInProgress()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<Order> GetOrderInProgress()
|
|
||||||
{
|
|
||||||
return Task.Run(() => { return _order; });
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveItemFromOrder(Guid itemIdentifier)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,31 +3,103 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.CodeAnalysis.Options;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using System.Net.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
||||||
{
|
{
|
||||||
public class CatalogService : ICatalogService
|
public class CatalogService : ICatalogService
|
||||||
{
|
{
|
||||||
List<CatalogItem> _items;
|
private readonly List<CatalogItem> _items; //Fake data while services are ready.
|
||||||
|
private readonly IOptions<AppSettings> _settings;
|
||||||
|
private HttpClient _apiClient;
|
||||||
|
private readonly string _remoteServiceBaseUrl;
|
||||||
|
private int _totalItems;
|
||||||
|
|
||||||
public CatalogService() {
|
public int TotalItems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _totalItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CatalogService(IOptions<AppSettings> settings) {
|
||||||
|
_settings = settings;
|
||||||
|
|
||||||
|
#region fake data
|
||||||
_items = new List<CatalogItem>()
|
_items = new List<CatalogItem>()
|
||||||
{
|
{
|
||||||
new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12 },
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
new CatalogItem() { Id = Guid.NewGuid(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17 },
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
new CatalogItem() { Id = Guid.NewGuid(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12 },
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
new CatalogItem() { Id = Guid.NewGuid(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5") }
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" },
|
||||||
|
new CatalogItem() { Id = Guid.NewGuid().ToString(), Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = decimal.Parse("19.5"), PictureUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }
|
||||||
};
|
};
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public CatalogItem GetCatalogItem(Guid Id)
|
public CatalogItem GetCatalogItem(string Id)
|
||||||
{
|
{
|
||||||
return _items.Where(x => x.Id == Id).FirstOrDefault();
|
return _items.Where(x => x.Id.Equals(Id)).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<CatalogItem>> GetCatalogItems()
|
public Task<List<CatalogItem>> GetCatalogItems(int? skip,int? take)
|
||||||
{
|
{
|
||||||
return Task.Run(() => { return _items; });
|
var res = _items;
|
||||||
|
|
||||||
|
_totalItems = _items.Count();
|
||||||
|
|
||||||
|
if (skip.HasValue)
|
||||||
|
return Task.Run(() => { return _items.Skip(skip.Value).Take(take.Value).ToList(); });
|
||||||
|
else
|
||||||
|
return Task.Run(() => { return _items; });
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<SelectListItem> GetBrands()
|
||||||
|
{
|
||||||
|
var items = new List<SelectListItem>();
|
||||||
|
items.Add(new SelectListItem() { Value = "0", Text = "All", Selected = true });
|
||||||
|
items.Add(new SelectListItem() { Value = "1", Text = "Visual Studio" });
|
||||||
|
items.Add(new SelectListItem() { Value = "2", Text = "Azure" });
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<SelectListItem> GetTypes()
|
||||||
|
{
|
||||||
|
var items = new List<SelectListItem>();
|
||||||
|
items.Add(new SelectListItem() { Value = "0", Text = "All", Selected = true });
|
||||||
|
items.Add(new SelectListItem() { Value = "1", Text = "Mug" });
|
||||||
|
items.Add(new SelectListItem() { Value = "2", Text = "T-Shirt" });
|
||||||
|
|
||||||
|
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
src/Web/WebMVC/Services/IBasketService.cs
Normal file
19
src/Web/WebMVC/Services/IBasketService.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
||||||
|
{
|
||||||
|
public interface IBasketService
|
||||||
|
{
|
||||||
|
Basket GetBasket(ApplicationUser user);
|
||||||
|
int ItemsInCart { get; }
|
||||||
|
void AddItemToBasket(ApplicationUser user, BasketItem product);
|
||||||
|
Basket UpdateBasket(Basket basket);
|
||||||
|
Basket SetQuantities(ApplicationUser user, Dictionary<string, int> quantities);
|
||||||
|
Order MapBasketToOrder(Basket basket);
|
||||||
|
void CleanBasket(ApplicationUser user);
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface ICartService
|
|
||||||
{
|
|
||||||
void AddItemToOrder(CatalogItem item);
|
|
||||||
void RemoveItemFromOrder(Guid itemIdentifier);
|
|
||||||
int GetItemCountFromOrderInProgress();
|
|
||||||
Task<Order> GetOrderInProgress();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -8,7 +9,11 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
{
|
{
|
||||||
public interface ICatalogService
|
public interface ICatalogService
|
||||||
{
|
{
|
||||||
Task<List<CatalogItem>> GetCatalogItems();
|
int TotalItems { get; }
|
||||||
CatalogItem GetCatalogItem(Guid Id);
|
|
||||||
|
Task<List<CatalogItem>> GetCatalogItems(int? skip, int? take);
|
||||||
|
CatalogItem GetCatalogItem(string Id);
|
||||||
|
IEnumerable<SelectListItem> GetBrands();
|
||||||
|
IEnumerable<SelectListItem> GetTypes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface IEmailSender
|
|
||||||
{
|
|
||||||
Task SendEmailAsync(string email, string subject, string message);
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,8 +8,10 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
{
|
{
|
||||||
public interface IOrderingService
|
public interface IOrderingService
|
||||||
{
|
{
|
||||||
List<Order> GetOrders();
|
List<Order> GetMyOrders(ApplicationUser user);
|
||||||
Order GetOrder(Guid Id);
|
Order GetOrder(ApplicationUser user, string orderId);
|
||||||
void AddOrder(Order Order);
|
void CreateOrder(ApplicationUser user, Order order);
|
||||||
|
Order MapUserInfoIntoOrder(ApplicationUser user, Order order);
|
||||||
|
void OverrideUserInfoIntoOrder(Order original, Order destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface ISmsSender
|
|
||||||
{
|
|
||||||
Task SendSmsAsync(string number, string message);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
// This class is used by the application to send Email and SMS
|
|
||||||
// when you turn on two-factor authentication in ASP.NET Identity.
|
|
||||||
// For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713
|
|
||||||
public class AuthMessageSender : IEmailSender, ISmsSender
|
|
||||||
{
|
|
||||||
public Task SendEmailAsync(string email, string subject, string message)
|
|
||||||
{
|
|
||||||
// Plug in your email service here to send an email.
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task SendSmsAsync(string number, string message)
|
|
||||||
{
|
|
||||||
// Plug in your SMS service here to send a text message.
|
|
||||||
return Task.FromResult(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,41 +3,107 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
||||||
{
|
{
|
||||||
public class OrderingService : IOrderingService
|
public class OrderingService : IOrderingService
|
||||||
{
|
{
|
||||||
private List<Order> _orders;
|
private List<Order> _orders;
|
||||||
|
private int _itemsInCart;
|
||||||
|
|
||||||
public OrderingService()
|
public int ItemsInCart { get { return _itemsInCart; } }
|
||||||
|
//var ordersUrl = _settings.OrderingUrl + "/api/ordering/orders";
|
||||||
|
//var dataString = await _http.GetStringAsync(ordersUrl);
|
||||||
|
//var items = JsonConvert.DeserializeObject<List<Order>>(dataString);
|
||||||
|
|
||||||
|
public OrderingService(IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_orders = new List<Order>()
|
_orders = new List<Order>()
|
||||||
{
|
{
|
||||||
new Order()
|
new Order()
|
||||||
{
|
{
|
||||||
BuyerId = Guid.NewGuid(), OrderDate = DateTime.Now,
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
BuyerId = new Guid("ebcbcb4c-b032-4baa-834b-7fd66d37bc95").ToString(),
|
||||||
|
OrderDate = DateTime.Now,
|
||||||
|
State = OrderState.InProcess,
|
||||||
OrderItems = new List<OrderItem>()
|
OrderItems = new List<OrderItem>()
|
||||||
{
|
{
|
||||||
new OrderItem() { UnitPrice = 12 }
|
new OrderItem() { UnitPrice = 12.40m, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt", Quantity = 1, ProductName="Roslyn Red T-Shirt" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Order()
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
BuyerId = new Guid("ebcbcb4c-b032-4baa-834b-7fd66d37bc95").ToString(),
|
||||||
|
OrderDate = DateTime.Now,
|
||||||
|
State = OrderState.InProcess,
|
||||||
|
OrderItems = new List<OrderItem>()
|
||||||
|
{
|
||||||
|
new OrderItem() { UnitPrice = 12.00m, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt", Quantity = 1, ProductName="Roslyn Red T-Shirt" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Order()
|
||||||
|
{
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
BuyerId = new Guid("ebcbcb4c-b032-4baa-834b-7fd66d37bc95").ToString(),
|
||||||
|
OrderDate = DateTime.Now,
|
||||||
|
State = OrderState.Delivered,
|
||||||
|
OrderItems = new List<OrderItem>()
|
||||||
|
{
|
||||||
|
new OrderItem() { UnitPrice = 12.05m, PictureUrl = "https://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt", Quantity = 1, ProductName="Roslyn Red T-Shirt" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddOrder(Order Order)
|
public Order GetOrder(ApplicationUser user, string Id)
|
||||||
{
|
{
|
||||||
_orders.Add(Order);
|
return _orders.Where(x => x.BuyerId.Equals(user.Id) && x.Id.Equals(Id)).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order GetOrder(Guid Id)
|
public List<Order> GetMyOrders(ApplicationUser user)
|
||||||
{
|
{
|
||||||
return _orders.Where(x => x.BuyerId == Id).FirstOrDefault();
|
return _orders.Where(x => x.BuyerId.Equals(user.Id)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Order> GetOrders()
|
public Order MapUserInfoIntoOrder(ApplicationUser user, Order order)
|
||||||
{
|
{
|
||||||
return _orders;
|
order.ShippingAddress.City = user.City;
|
||||||
|
order.ShippingAddress.Street = user.Street;
|
||||||
|
order.ShippingAddress.State = user.State;
|
||||||
|
order.ShippingAddress.Country = user.Country;
|
||||||
|
|
||||||
|
order.PaymentInfo.CardNumber = user.CardNumber;
|
||||||
|
order.PaymentInfo.CardHolderName = user.CardHolderName;
|
||||||
|
order.PaymentInfo.Expiration = user.Expiration;
|
||||||
|
order.PaymentInfo.SecurityNumber = user.SecurityNumber;
|
||||||
|
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateOrder(ApplicationUser user, Order order)
|
||||||
|
{
|
||||||
|
order.OrderDate = DateTime.Now;
|
||||||
|
order.Id = Guid.NewGuid().ToString();
|
||||||
|
order.BuyerId = user.Id;
|
||||||
|
order.SequenceNumber = new Random(100).Next();
|
||||||
|
order.State = OrderState.InProcess;
|
||||||
|
|
||||||
|
_orders.Add(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OverrideUserInfoIntoOrder(Order original, Order destination)
|
||||||
|
{
|
||||||
|
destination.ShippingAddress.City = original.ShippingAddress.City;
|
||||||
|
destination.ShippingAddress.Street = original.ShippingAddress.Street;
|
||||||
|
destination.ShippingAddress.State = original.ShippingAddress.State;
|
||||||
|
destination.ShippingAddress.Country = original.ShippingAddress.Country;
|
||||||
|
|
||||||
|
destination.PaymentInfo.CardNumber = original.PaymentInfo.CardNumber;
|
||||||
|
destination.PaymentInfo.CardHolderName = original.PaymentInfo.CardHolderName;
|
||||||
|
destination.PaymentInfo.Expiration = original.PaymentInfo.Expiration;
|
||||||
|
destination.PaymentInfo.SecurityNumber = original.PaymentInfo.SecurityNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,14 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
|
// CCE : Session not apply in this demo we have a mservice to store in redis. (BasketService) Once it's ready I've to remove this lines
|
||||||
|
services.AddDistributedMemoryCache(); // default implementation (in memory), you can move to SQL or custom store that could be Redis..
|
||||||
|
services.AddSession();
|
||||||
|
|
||||||
// Add application services.
|
// Add application services.
|
||||||
services.AddTransient<IEmailSender, AuthMessageSender>();
|
services.AddSingleton<ICatalogService, CatalogService>(); //CCE: Once services are integrated, a singleton is not needed we can left transient.
|
||||||
services.AddTransient<ISmsSender, AuthMessageSender>();
|
services.AddSingleton<IOrderingService, OrderingService>();
|
||||||
services.AddTransient<ICatalogService, CatalogService>();
|
services.AddTransient<IBasketService, BasketService>();
|
||||||
services.AddTransient<IOrderingService, OrderingService>();
|
|
||||||
services.AddTransient<ICartService, CartService>();
|
|
||||||
|
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
}
|
}
|
||||||
@ -73,20 +75,21 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Catalog/Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
||||||
app.UseIdentity();
|
app.UseIdentity();
|
||||||
|
|
||||||
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
|
//CCE: Remember to remove this line once Basket mservice is ready.
|
||||||
|
app.UseSession();
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
template: "{controller=Catalog}/{action=Index}/{id?}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,21 +10,22 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|||||||
{
|
{
|
||||||
public class Cart : ViewComponent
|
public class Cart : ViewComponent
|
||||||
{
|
{
|
||||||
private readonly ICartService _cartSvc;
|
private readonly IBasketService _cartSvc;
|
||||||
|
|
||||||
public Cart(ICartService cartSvc)
|
public Cart(IBasketService cartSvc)
|
||||||
{
|
{
|
||||||
_cartSvc = cartSvc;
|
_cartSvc = cartSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IViewComponentResult> InvokeAsync()
|
public async Task<IViewComponentResult> InvokeAsync(ApplicationUser user)
|
||||||
{
|
{
|
||||||
var item = await GetItemsAsync();
|
var itemsInCart = await ItemsInCartAsync(user);
|
||||||
return View(item);
|
return View(itemsInCart);
|
||||||
}
|
}
|
||||||
private Task<Order> GetItemsAsync()
|
private Task<int> ItemsInCartAsync(ApplicationUser user)
|
||||||
{
|
{
|
||||||
return _cartSvc.GetOrderInProgress();
|
_cartSvc.GetBasket(user);
|
||||||
|
return Task.Run ( ()=> { return _cartSvc.ItemsInCart; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
src/Web/WebMVC/ViewComponents/CartList.cs
Normal file
30
src/Web/WebMVC/ViewComponents/CartList.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Models;
|
||||||
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
||||||
|
{
|
||||||
|
public class CartList : ViewComponent
|
||||||
|
{
|
||||||
|
private readonly IBasketService _cartSvc;
|
||||||
|
|
||||||
|
public CartList(IBasketService cartSvc)
|
||||||
|
{
|
||||||
|
_cartSvc = cartSvc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IViewComponentResult> InvokeAsync(ApplicationUser user)
|
||||||
|
{
|
||||||
|
var item = await GetItemsAsync(user);
|
||||||
|
return View(item);
|
||||||
|
}
|
||||||
|
private Task<Basket> GetItemsAsync(ApplicationUser user)
|
||||||
|
{
|
||||||
|
return Task.Run(()=> { return _cartSvc.GetBasket(user); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Confirm Email";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
Thank you for confirming your email. Please <a asp-controller="Account" asp-action="Login">Click here to Log in</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
@ -1,35 +0,0 @@
|
|||||||
@model ExternalLoginConfirmationViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Register";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<h3>Associate your @ViewData["LoginProvider"] account.</h3>
|
|
||||||
|
|
||||||
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
|
||||||
<h4>Association Form</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
|
|
||||||
<p class="text-info">
|
|
||||||
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>.
|
|
||||||
Please enter an email address for this site below and click the Register button to finish
|
|
||||||
logging in.
|
|
||||||
</p>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Email" class="form-control" />
|
|
||||||
<span asp-validation-for="Email" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Register</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Login Failure";
|
|
||||||
}
|
|
||||||
|
|
||||||
<header>
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<p class="text-danger">Unsuccessful login with service.</p>
|
|
||||||
</header>
|
|
@ -1,31 +0,0 @@
|
|||||||
@model ForgotPasswordViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Forgot your password?";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"]</h2>
|
|
||||||
<p>
|
|
||||||
For more information on how to enable reset password please see this <a href="http://go.microsoft.com/fwlink/?LinkID=532713">article</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
@*<form asp-controller="Account" asp-action="ForgotPassword" method="post" class="form-horizontal">
|
|
||||||
<h4>Enter your email.</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Email" class="form-control" />
|
|
||||||
<span asp-validation-for="Email" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>*@
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Forgot Password Confirmation";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<p>
|
|
||||||
Please check your email to reset your password.
|
|
||||||
</p>
|
|
@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Locked out";
|
|
||||||
}
|
|
||||||
|
|
||||||
<header>
|
|
||||||
<h1 class="text-danger">Locked out.</h1>
|
|
||||||
<p class="text-danger">This account has been locked out, please try again later.</p>
|
|
||||||
</header>
|
|
@ -30,23 +30,20 @@
|
|||||||
<input asp-for="Password" class="form-control form-input form-input-center" />
|
<input asp-for="Password" class="form-control form-input form-input-center" />
|
||||||
<span asp-validation-for="Password" class="text-danger"></span>
|
<span asp-validation-for="Password" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
@*<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label asp-for="RememberMe">
|
<label asp-for="RememberMe">
|
||||||
<input asp-for="RememberMe" />
|
<input asp-for="RememberMe" />
|
||||||
@Html.DisplayNameFor(m => m.RememberMe)
|
@Html.DisplayNameFor(m => m.RememberMe)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>*@
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-default btn-brand btn-brand-big"> LOG IN </button>
|
<button type="submit" class="btn btn-default btn-brand btn-brand-big"> LOG IN </button>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" class="text">Register as a new user?</a>
|
<a asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" class="text">Register as a new user?</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
@*<a asp-action="ForgotPassword" class="text">Forgot your password?</a>*@
|
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="container cart-index-container">
|
<div class="container cart-index-container">
|
||||||
@*<h2>@ViewData["Title"].</h2>*@
|
|
||||||
<h4 class="order-create-section-title">CREATE NEW ACCOUNT</h4>
|
<h4 class="order-create-section-title">CREATE NEW ACCOUNT</h4>
|
||||||
<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
||||||
@*<div asp-validation-summary="All" class="text-danger"></div>*@
|
<div asp-validation-summary="All" class="text-danger"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="User.Name" class="control-label form-label">NAME</label>
|
<label asp-for="User.Name" class="control-label form-label">NAME</label>
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
@model ResetPasswordViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Reset password";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
|
|
||||||
<form asp-controller="Account" asp-action="ResetPassword" method="post" class="form-horizontal">
|
|
||||||
<h4>Reset your password.</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<input asp-for="Code" type="hidden" />
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Email" class="form-control" />
|
|
||||||
<span asp-validation-for="Email" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Password" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Password" class="form-control" />
|
|
||||||
<span asp-validation-for="Password" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="ConfirmPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Reset</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Reset password confirmation";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h1>@ViewData["Title"].</h1>
|
|
||||||
<p>
|
|
||||||
Your password has been reset. Please <a asp-controller="Account" asp-action="Login">Click here to log in</a>.
|
|
||||||
</p>
|
|
@ -1,21 +0,0 @@
|
|||||||
@model SendCodeViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Send Verification Code";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
|
|
||||||
<form asp-controller="Account" asp-action="SendCode" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
|
||||||
<input asp-for="RememberMe" type="hidden" />
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8">
|
|
||||||
Select Two-Factor Authentication Provider:
|
|
||||||
<select asp-for="SelectedProvider" asp-items="Model.Providers"></select>
|
|
||||||
<button type="submit" class="btn btn-default">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
@model VerifyCodeViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Verify";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
|
|
||||||
<form asp-controller="Account" asp-action="VerifyCode" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<input asp-for="Provider" type="hidden" />
|
|
||||||
<input asp-for="RememberMe" type="hidden" />
|
|
||||||
<h4>@ViewData["Status"]</h4>
|
|
||||||
<hr />
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Code" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Code" class="form-control" />
|
|
||||||
<span asp-validation-for="Code" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<div class="checkbox">
|
|
||||||
<input asp-for="RememberBrowser" />
|
|
||||||
<label asp-for="RememberBrowser"></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
25
src/Web/WebMVC/Views/Cart/Index.cshtml
Normal file
25
src/Web/WebMVC/Views/Cart/Index.cshtml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
|
||||||
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "My Cart";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="brand-header-block">
|
||||||
|
<ul class="container">
|
||||||
|
<li class="brand-header-back"><a asp-area="" asp-controller="Catalog" asp-action="Index">Back to list</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post" id="cartForm">
|
||||||
|
<div class="container cart-index-container">
|
||||||
|
<div class="row">
|
||||||
|
@await Component.InvokeAsync("CartList", new { user = await UserManager.GetUserAsync(User) })
|
||||||
|
<div class="col-md-offset-8 col-md-4">
|
||||||
|
<input type="submit"
|
||||||
|
class="btn btn-default btn-brand btn-cart"
|
||||||
|
value="[ Checkout ]" name="action" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
110
src/Web/WebMVC/Views/Catalog/Index.cshtml
Normal file
110
src/Web/WebMVC/Views/Catalog/Index.cshtml
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Catalog";
|
||||||
|
@model Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels.IndexViewModel
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row home-banner">
|
||||||
|
<div class="container home-banner-text"><img src="~/images/main_banner_text.png" /></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="home-catalog-filter-container">
|
||||||
|
<div class="container">
|
||||||
|
<form asp-action="Index" asp-controller="Catalog" method="post">
|
||||||
|
<div data-name="brand" class="select-filter-wrapper">
|
||||||
|
<img src="~/images/arrow-down.png" class="select-filter-arrow" />
|
||||||
|
<select asp-for="@Model.BrandFilterApplied" asp-items="@Model.Brands" class="select-filter"></select>
|
||||||
|
</div>
|
||||||
|
<div data-name="type" class="select-filter-wrapper">
|
||||||
|
<img src="~/images/arrow-down.png" class="select-filter-arrow" />
|
||||||
|
<select asp-for="@Model.TypesFilterApplied" asp-items="@Model.Types" class="select-filter"></select>
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn-brand btn-brand-small btn-brand-small-filter btn-catalog-apply" value="APPLY" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container home-catalog-container">
|
||||||
|
<div class="container es-pager-top">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="text previous @Model.PaginationInfo.Previous" id="Previous"
|
||||||
|
href="@Url.Action("Index","Catalog", new { page = Model.PaginationInfo.ActualPage -1 })"
|
||||||
|
aria-label="Previous">
|
||||||
|
<span>Previous</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-4 u-align-center"><span>Showing @Html.DisplayFor(modelItem => modelItem.PaginationInfo.ItemsPerPage) of @Html.DisplayFor(modelItem => modelItem.PaginationInfo.TotalItems) products - Page @(Model.PaginationInfo.ActualPage + 1) of @Html.DisplayFor(x => x.PaginationInfo.TotalPages)</span></div>
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="text next @Model.PaginationInfo.Next" id="Next"
|
||||||
|
href="@Url.Action("Index","Catalog", new { page = Model.PaginationInfo.ActualPage + 1 })"
|
||||||
|
aria-label="Next">
|
||||||
|
<span>Next</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
@foreach (var catalogItem in Model.CatalogItems)
|
||||||
|
{
|
||||||
|
<div class="col-sm-4 home-catalog-item">
|
||||||
|
<form asp-controller="Cart" asp-action="AddToCart" asp-route-productId="@catalogItem.Id">
|
||||||
|
<div class="home-catalog-item-image">
|
||||||
|
<img src="@catalogItem.PictureUrl" />
|
||||||
|
<input type="submit" value="[ ADD TO CART ]" class="btn-brand home-catalog-item-image-addCart" />
|
||||||
|
</div>
|
||||||
|
<div class="home-catalog-item-title">
|
||||||
|
<span>@catalogItem.Name</span>
|
||||||
|
</div>
|
||||||
|
<div class="home-catalog-item-price">
|
||||||
|
<span>@catalogItem.Price.ToString("N2")</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="container es-pager-bottom">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="text previous @Model.PaginationInfo.Previous" id="Previous"
|
||||||
|
href="@Url.Action("Index","Catalog", new { page = Model.PaginationInfo.ActualPage + -1 })"
|
||||||
|
aria-label="Previous">
|
||||||
|
<span>Previous</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-4 u-align-center"><span>Showing @Html.DisplayFor(modelItem => modelItem.PaginationInfo.ItemsPerPage) of @Html.DisplayFor(modelItem => modelItem.PaginationInfo.TotalItems) products - Page @(Model.PaginationInfo.ActualPage + 1) of @Html.DisplayFor(x => x.PaginationInfo.TotalPages)</span></div>
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="text next @Model.PaginationInfo.Next" id="Next"
|
||||||
|
href="@Url.Action("Index","Catalog", new { page = Model.PaginationInfo.ActualPage + 1 })"
|
||||||
|
aria-label="Next">
|
||||||
|
<span>Next</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,67 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Home Page";
|
|
||||||
@model Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels.IndexViewModel
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row home-banner">
|
|
||||||
<div class="container home-banner-text"><img src="~/images/main_banner_text.png" /></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="home-catalog-filter-container">
|
|
||||||
<div class="container">
|
|
||||||
@*<ul class="nav navbar-nav col-sm-6 home-catalog-filter-brands">
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Index" class="btn-bracketed">ALL</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="About" class="btn-bracketed">AZURE</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact" class="btn-bracketed">.NET</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Orders" class="btn-bracketed">LOREM</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Orders" class="btn-bracketed">IPSUM</a></li>
|
|
||||||
</ul>
|
|
||||||
<ul class="nav navbar-nav col-sm-6 home-catalog-filter-types">
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Index" class="btn-bracketed">ALL</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="About" class="btn-bracketed">T-SHIRT</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact" class="btn-bracketed">STICKER</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Orders" class="btn-bracketed">MUGS</a></li>
|
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Orders" class="btn-bracketed">SWEATSHIRT</a></li>
|
|
||||||
</ul>*@
|
|
||||||
<div data-name="brand" class="select-filter-wrapper">
|
|
||||||
<img src="~/images/arrow-down.png" class="select-filter-arrow" />
|
|
||||||
<select asp-for="BrandFilterApplied" asp-items="Model.Brands" class="select-filter" >
|
|
||||||
<option>ALL</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div data-name="type" class="select-filter-wrapper">
|
|
||||||
<img src="~/images/arrow-down.png" class="select-filter-arrow" />
|
|
||||||
<select asp-for="TypesFilterApplied" asp-items="Model.Types" class="select-filter">
|
|
||||||
<option>ALL</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<a asp-area="" asp-controller="Home" asp-action="About" class="btn-brand btn-brand-small btn-brand-small-filter">
|
|
||||||
APPLY
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container home-catalog-container">
|
|
||||||
<div class="row">
|
|
||||||
@foreach (var catalogItem in Model.CatalogItems)
|
|
||||||
{
|
|
||||||
<div class="col-sm-4 home-catalog-item">
|
|
||||||
<div class="home-catalog-item-image" >
|
|
||||||
<img src="~/images/product_temp.PNG" />
|
|
||||||
<a asp-area="" asp-controller="Home" asp-action="About" class="btn-brand home-catalog-item-image-addCart">
|
|
||||||
ADD TO CART
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="home-catalog-item-title">
|
|
||||||
<span>@catalogItem.Name</span>
|
|
||||||
</div>
|
|
||||||
<div class="home-catalog-item-price">
|
|
||||||
<span>@catalogItem.Price.ToString("N2")</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Orders";
|
|
||||||
@model IEnumerable<Order>
|
|
||||||
}
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<h3>@ViewData["Message"]</h3>
|
|
||||||
|
|
||||||
|
|
||||||
@foreach (var order in Model)
|
|
||||||
{
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">
|
|
||||||
<strong>Order Number:</strong> @order.OrderNumber
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<strong>BuyerId: </strong> @order.BuyerId <br />
|
|
||||||
<strong>OrderDate: </strong> @order.OrderDate <br />
|
|
||||||
<strong>SequenceNumber: </strong> @order.SequenceNumber <br />
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<address>
|
|
||||||
<strong>Street: </strong> @order.ShippingAddress.Street <br />
|
|
||||||
<strong>City: </strong> @order.ShippingAddress.City <br />
|
|
||||||
<strong>State: </strong> @order.ShippingAddress.State <br />
|
|
||||||
<strong>StateCode: </strong> @order.ShippingAddress.StateCode <br />
|
|
||||||
<strong>Country: </strong> @order.ShippingAddress.Country <br />
|
|
||||||
<strong>CountryCode: </strong> @order.ShippingAddress.CountryCode <br />
|
|
||||||
<strong>ZipCode: </strong> @order.ShippingAddress.ZipCode <br />
|
|
||||||
<strong>Latitude: </strong> @order.ShippingAddress.Latitude <br />
|
|
||||||
<strong>Longitude: </strong> @order.ShippingAddress.Longitude <br />
|
|
||||||
</address>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
@foreach (var orderItem in order.OrderItems)
|
|
||||||
{
|
|
||||||
<address>
|
|
||||||
<strong>ProductId: </strong> @orderItem.ProductId <br />
|
|
||||||
<strong>ProductName: </strong> @orderItem.ProductName <br />
|
|
||||||
<strong>Price: </strong> @orderItem.UnitPrice <br />
|
|
||||||
<strong>Quantity: </strong> @orderItem.Quantity <br />
|
|
||||||
<strong>Discount: </strong> @orderItem.Discount <br />
|
|
||||||
</address>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
@model AddPhoneNumberViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Add Phone Number";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
<form asp-controller="Manage" asp-action="AddPhoneNumber" method="post" class="form-horizontal">
|
|
||||||
<h4>Add a phone number.</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="PhoneNumber" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="PhoneNumber" class="form-control" />
|
|
||||||
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Send verification code</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
@model ChangePasswordViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Change Password";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form asp-controller="Manage" asp-action="ChangePassword" method="post" class="form-horizontal">
|
|
||||||
<h4>Change Password Form</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="OldPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="OldPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="OldPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="NewPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="NewPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="ConfirmPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Change password</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
@model IndexViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Manage your account";
|
|
||||||
}
|
|
||||||
|
|
||||||
@*<h2>@ViewData["Title"].</h2>*@
|
|
||||||
<p class="text-success">@ViewData["StatusMessage"]</p>
|
|
||||||
<div class="brand-header-block">
|
|
||||||
<ul class="container">
|
|
||||||
<li class="brand-header-back"><a asp-area="" asp-controller="Home" asp-action="Index">Back to list</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="container cart-index-container">
|
|
||||||
<form asp-controller="Manage" asp-action="Index" method="post" class="form-horizontal">
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-8 col-md-4">
|
|
||||||
<button type="submit" class="btn btn-default btn-brand">[ Save ]</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h4 class="order-create-section-title">SHIPPING ADDRESS</h4>
|
|
||||||
<div class="form-horizontal row">
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.Street" class="control-label form-label">ADDRESS</label>
|
|
||||||
<input asp-for="User.Street" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.Street" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.City" class="control-label form-label"></label>
|
|
||||||
<input asp-for="User.City" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.City" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.State" class="control-label form-label"></label>
|
|
||||||
<input asp-for="User.State" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.State" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.Country" class="control-label form-label"></label>
|
|
||||||
<input asp-for="User.Country" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.Country" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.ZipCode" class="control-label form-label"></label>
|
|
||||||
<input asp-for="User.ZipCode" class="form-control form-input form-input-small" />
|
|
||||||
<span asp-validation-for="User.ZipCode" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br /><br />
|
|
||||||
<div class="order-create-section-payment">
|
|
||||||
<h4 class="order-create-section-title">PAYMENT METHOD</h4>
|
|
||||||
<div class="form-horizontal row">
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.CardNumber" class="control-label form-label">Card Number</label>
|
|
||||||
<input asp-for="User.CardNumber" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.CardNumber" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.CardHolderName" class="control-label form-label">Cardholder Name</label>
|
|
||||||
<input asp-for="User.CardHolderName" class="form-control form-input" />
|
|
||||||
<span asp-validation-for="User.CardHolderName" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-3">
|
|
||||||
<label asp-for="User.Expiration" class="control-label form-label">Expiration Date</label>
|
|
||||||
<input asp-for="User.Expiration" placeholder="MM/YY" class="form-control form-input form-input-small" />
|
|
||||||
<span asp-validation-for="User.Expiration" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-sm-3">
|
|
||||||
<label asp-for="User.SecurityNumber" class="control-label form-label">Security Code</label>
|
|
||||||
<input asp-for="User.SecurityNumber" class="form-control form-input form-input-small" />
|
|
||||||
<span asp-validation-for="User.SecurityNumber" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br /><br />
|
|
||||||
<h4 class="order-create-section-title">Change your account settings</h4>
|
|
||||||
<div class="form-horizontal row">
|
|
||||||
<div class="form-group col-sm-6">
|
|
||||||
<label asp-for="User.Street" class="control-label form-label">PASSWORD</label>
|
|
||||||
<br />
|
|
||||||
@if (Model.HasPassword)
|
|
||||||
{
|
|
||||||
<a asp-controller="Manage" asp-action="ChangePassword" class="text">Change</a>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<a asp-controller="Manage" asp-action="SetPassword" class="text">Create</a>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br /><br />
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-8 col-md-4">
|
|
||||||
<button type="submit" class="btn btn-default btn-brand">[ Save ]</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br /><br />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
@model ManageLoginsViewModel
|
|
||||||
@using Microsoft.AspNetCore.Http.Authentication
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Manage your external logins";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
|
|
||||||
<p class="text-success">@ViewData["StatusMessage"]</p>
|
|
||||||
@if (Model.CurrentLogins.Count > 0)
|
|
||||||
{
|
|
||||||
<h4>Registered Logins</h4>
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
@for (var index = 0; index < Model.CurrentLogins.Count; index++)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td>@Model.CurrentLogins[index].LoginProvider</td>
|
|
||||||
<td>
|
|
||||||
@if ((bool)ViewData["ShowRemoveButton"])
|
|
||||||
{
|
|
||||||
<form asp-controller="Manage" asp-action="RemoveLogin" method="post" class="form-horizontal">
|
|
||||||
<div>
|
|
||||||
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" />
|
|
||||||
<input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" />
|
|
||||||
<input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@:
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
@if (Model.OtherLogins.Count > 0)
|
|
||||||
{
|
|
||||||
<h4>Add another service to log in.</h4>
|
|
||||||
<hr />
|
|
||||||
<form asp-controller="Manage" asp-action="LinkLogin" method="post" class="form-horizontal">
|
|
||||||
<div id="socialLoginList">
|
|
||||||
<p>
|
|
||||||
@foreach (var provider in Model.OtherLogins)
|
|
||||||
{
|
|
||||||
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
|
|
||||||
}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
@model SetPasswordViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Set Password";
|
|
||||||
}
|
|
||||||
|
|
||||||
<p class="text-info">
|
|
||||||
You do not have a local username/password for this site. Add a local
|
|
||||||
account so you can log in without an external login.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form asp-controller="Manage" asp-action="SetPassword" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
|
||||||
<h4>Set your password</h4>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="NewPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="NewPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="NewPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="ConfirmPassword" class="form-control" />
|
|
||||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Set password</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
@model VerifyPhoneNumberViewModel
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Verify Phone Number";
|
|
||||||
}
|
|
||||||
|
|
||||||
<h2>@ViewData["Title"].</h2>
|
|
||||||
|
|
||||||
<form asp-controller="Manage" asp-action="VerifyPhoneNumber" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
|
|
||||||
<input asp-for="PhoneNumber" type="hidden" />
|
|
||||||
<h4>Add a phone number.</h4>
|
|
||||||
<h5>@ViewData["Status"]</h5>
|
|
||||||
<hr />
|
|
||||||
<div asp-validation-summary="All" class="text-danger"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Code" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="Code" class="form-control" />
|
|
||||||
<span asp-validation-for="Code" class="text-danger"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<button type="submit" class="btn btn-default">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
@section Scripts {
|
|
||||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
@model Microsoft.eShopOnContainers.WebMVC.Models.Order
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "My Cart";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="brand-header-block">
|
|
||||||
<ul class="container">
|
|
||||||
<li class="brand-header-back"><a asp-area="" asp-controller="Home" asp-action="Index">Back to list</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="container cart-index-container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-offset-8 col-md-4">
|
|
||||||
<a asp-controller="Home" asp-action="Index" class="btn btn-default btn-brand btn-brand-dark btn-cart"> Continue Shopping </a>
|
|
||||||
</div>
|
|
||||||
<br /><br /><br /><br />
|
|
||||||
<div class="col-md-12">
|
|
||||||
<section>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
PRODUCT
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
BRAND
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
PRICE
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
QUANTITY
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
FINAL PRICE
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@await Component.InvokeAsync("Cart")
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<br /><br /><br /><br /><br /><br />
|
|
||||||
<div class="col-md-offset-8 col-md-4">
|
|
||||||
<a asp-controller="Order" asp-action="Create" class="btn btn-default btn-brand btn-cart"> CheckOut </a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,36 +1,37 @@
|
|||||||
@model Microsoft.eShopOnContainers.WebMVC.Models.Order
|
@model Microsoft.eShopOnContainers.WebMVC.Models.OrderViewModels.CreateOrderViewModel
|
||||||
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "View";
|
ViewData["Title"] = "New Order";
|
||||||
}
|
}
|
||||||
<div class="brand-header-block">
|
<div class="brand-header-block">
|
||||||
<ul class="container">
|
<ul class="container">
|
||||||
<li class="brand-header-back"><a asp-area="" asp-controller="Order" asp-action="Cart">Back to list</a></li>
|
<li class="brand-header-back"><a asp-area="" asp-controller="Cart" asp-action="Index">Back to cart</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="container cart-index-container">
|
<div class="container order-create-container">
|
||||||
<form asp-action="View">
|
<form method="post" asp-controller="Order" asp-action="Create">
|
||||||
<h4 class="order-create-section-title">SHIPPING ADDRESS</h4>
|
<h4 class="order-create-section-title">SHIPPING ADDRESS</h4>
|
||||||
<div class="form-horizontal row">
|
<div class="form-horizontal row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="OrderNumber" class="control-label form-label">order number</label>
|
<label asp-for="Order.ShippingAddress.Street" class="control-label form-label">Address</label>
|
||||||
<input asp-for="OrderNumber" class="form-control form-input" />
|
<input asp-for="Order.ShippingAddress.Street" class="form-control form-input" />
|
||||||
<span asp-validation-for="OrderNumber" class="text-danger" />
|
<span asp-validation-for="Order.ShippingAddress.Street" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="SequenceNumber" class="control-label form-label"></label>
|
<label asp-for="Order.ShippingAddress.City" class="control-label form-label">City</label>
|
||||||
<input asp-for="SequenceNumber" class="form-control form-input" />
|
<input asp-for="Order.ShippingAddress.City" class="form-control form-input" />
|
||||||
<span asp-validation-for="SequenceNumber" class="text-danger" />
|
<span asp-validation-for="Order.ShippingAddress.City" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="BuyerId" class="control-label form-label"></label>
|
<label asp-for="Order.ShippingAddress.State" class="control-label form-label">State</label>
|
||||||
<input asp-for="BuyerId" class="form-control form-input" />
|
<input asp-for="Order.ShippingAddress.State" class="form-control form-input" />
|
||||||
<span asp-validation-for="BuyerId" class="text-danger" />
|
<span asp-validation-for="Order.ShippingAddress.State" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="OrderDate" class="control-label form-label"></label>
|
<label asp-for="Order.ShippingAddress.Country" class="control-label form-label">Country</label>
|
||||||
<input asp-for="OrderDate" class="form-control form-input" />
|
<input asp-for="Order.ShippingAddress.Country" class="form-control form-input" />
|
||||||
<span asp-validation-for="OrderDate" class="text-danger" />
|
<span asp-validation-for="Order.ShippingAddress.Country" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
@ -38,73 +39,40 @@
|
|||||||
<h4 class="order-create-section-title">PAYMENT METHOD</h4>
|
<h4 class="order-create-section-title">PAYMENT METHOD</h4>
|
||||||
<div class="form-horizontal row">
|
<div class="form-horizontal row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="OrderNumber" class="control-label form-label">Card Number</label>
|
<label asp-for="Order.PaymentInfo.CardNumber" class="control-label form-label">Card Number</label>
|
||||||
<input asp-for="OrderNumber" class="form-control form-input" />
|
<input asp-for="Order.PaymentInfo.CardNumber" class="form-control form-input" />
|
||||||
<span asp-validation-for="OrderNumber" class="text-danger" />
|
<span asp-validation-for="Order.PaymentInfo.CardNumber" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-6">
|
||||||
<label asp-for="OrderNumber" class="control-label form-label">Cardholder Name</label>
|
<label asp-for="Order.PaymentInfo.CardHolderName" class="control-label form-label">Cardholder Name</label>
|
||||||
<input asp-for="OrderNumber" class="form-control form-input" />
|
<input asp-for="Order.PaymentInfo.CardHolderName" class="form-control form-input" />
|
||||||
<span asp-validation-for="OrderNumber" class="text-danger" />
|
<span asp-validation-for="Order.PaymentInfo.CardHolderName" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-horizontal row">
|
<div class="form-horizontal row">
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-3">
|
||||||
<label asp-for="OrderNumber" class="control-label form-label">Expiration Date</label>
|
<label asp-for="Order.PaymentInfo.Expiration" class="control-label form-label">Expiration Date</label>
|
||||||
<select asp-for="OrderNumber" class="form-control form-select" />
|
<input asp-for="Order.PaymentInfo.Expiration" placeholder="MM/YY" class="form-control form-select" />
|
||||||
<span asp-validation-for="OrderNumber" class="text-danger" />
|
<span asp-validation-for="Order.PaymentInfo.Expiration" class="text-danger" />
|
||||||
<br />
|
|
||||||
<label asp-for="OrderDate" class="control-label form-label">hhh</label>
|
|
||||||
<select asp-for="OrderDate" class="form-control form-select" />
|
|
||||||
<span asp-validation-for="OrderDate" class="text-danger" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-sm-6">
|
<div class="form-group col-sm-3">
|
||||||
<label asp-for="OrderNumber" class="control-label form-label">Security Code</label>
|
<label asp-for="Order.PaymentInfo.SecurityNumber" class="control-label form-label">Security Code</label>
|
||||||
<input asp-for="OrderNumber" class="form-control form-input form-input-small" />
|
<input asp-for="Order.PaymentInfo.SecurityNumber" class="form-control form-input form-input-small" />
|
||||||
<span asp-validation-for="OrderNumber" class="text-danger" />
|
<span asp-validation-for="Order.PaymentInfo.SecurityNumber" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<div class="col-md-12 order-create-section-items">
|
<div class="col-md-12 order-create-section-items">
|
||||||
<section>
|
<section>
|
||||||
<table class="table">
|
@await Component.InvokeAsync("CartList", new { user = await UserManager.GetUserAsync(User) })
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
PRODUCT
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
BRAND
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
PRICE
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
QUANTITY
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
FINAL PRICE
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@await Component.InvokeAsync("Cart")
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<br /><br /><br /><br /><br /><br />
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-8 col-md-4">
|
<div class="col-md-offset-8 col-md-4">
|
||||||
@*<input type="submit" value="[ PLACE ORDER ]" class="btn btn-default btn-brand" />*@
|
<input type="submit" value="[ PLACE ORDER ]" class="btn btn-default btn-brand btn-cart" />
|
||||||
<a asp-controller="Order" asp-action="Index" class="btn btn-default btn-brand">[ PLACE ORDER ]</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br /><br /><br /><br /><br /><br />
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
|
84
src/Web/WebMVC/Views/Order/Detail.cshtml
Normal file
84
src/Web/WebMVC/Views/Order/Detail.cshtml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
@model Microsoft.eShopOnContainers.WebMVC.Models.Order
|
||||||
|
@inject UserManager<ApplicationUser> UserManager
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Order Detail";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="brand-header-block">
|
||||||
|
<ul class="container">
|
||||||
|
<li class="brand-header-back"><a asp-area="" asp-controller="Catalog" asp-action="Index">Back to list</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container order-detail-container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<span>ORDER NUMBER</span><br />
|
||||||
|
<span>@Model.OrderNumber</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<span>DATE</span><br />
|
||||||
|
<span>@Model.OrderDate</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<span>TOTAL</span><br />
|
||||||
|
<span>$ @Model.Total()</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<span>STATUS</span><br />
|
||||||
|
<span>@Model.State</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row order-detail-section">
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<span>SHIPING ADDRESS</span><br />
|
||||||
|
<span>@Model.ShippingAddress.Street</span><br />
|
||||||
|
<span>@Model.ShippingAddress.City</span><br />
|
||||||
|
@*<span>@Model.ShippingAddress.ZipCode</span><br />*@
|
||||||
|
<span>@Model.ShippingAddress.Country</span><br />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="row order-detail-section"><div class="col-sm-3">ORDER DETAILS</div></div>
|
||||||
|
<section>
|
||||||
|
<table class="table">
|
||||||
|
<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" /></td>
|
||||||
|
<td class="cart-product-column">@item.ProductName</td>
|
||||||
|
<td class="cart-product-column">ROSLYN</td>
|
||||||
|
<td class="cart-product-column">$ @item.UnitPrice</td>
|
||||||
|
<td class="cart-product-column">@item.Quantity</td>
|
||||||
|
<td class="cart-product-column cart-total-value">$ @(item.Quantity * item.UnitPrice)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-offset-9 col-md-3">
|
||||||
|
@*<input type="submit"
|
||||||
|
class="btn btn-default cart-refresh-button"
|
||||||
|
value=""
|
||||||
|
name="action" />*@
|
||||||
|
<div class="order-section-total">
|
||||||
|
@*<div class="cart-subtotal-label"><span>SUBTOTAL</span></div>
|
||||||
|
<div class="cart-subtotal-value"><span>$ @Model.Total()</span></div>
|
||||||
|
<div class="cart-subtotal-label"><span>TAX</span></div>
|
||||||
|
<div class="cart-subtotal-value"><span>$ 4.20</span></div>*@
|
||||||
|
<div class="cart-total-label"><span>TOTAL</span></div>
|
||||||
|
<div class="cart-total-value"><span>$ @Model.Total()</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,29 +1,28 @@
|
|||||||
@model IEnumerable<Microsoft.eShopOnContainers.WebMVC.Models.Order>
|
@model IEnumerable<Microsoft.eShopOnContainers.WebMVC.Models.Order>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "View";
|
ViewData["Title"] = "My Orders";
|
||||||
}
|
}
|
||||||
<div class="brand-header-block">
|
<div class="brand-header-block">
|
||||||
<ul class="container">
|
<ul class="container">
|
||||||
<li class="brand-header-back"><a asp-area="" asp-controller="Home" asp-action="Index">Back to home</a></li>
|
<li class="brand-header-back"><a asp-area="" asp-controller="Catalog" asp-action="Index">Back to home</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="container cart-index-container">
|
<div class="container order-index-container">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.OrderNumber)
|
ORDER NUMBER
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.OrderDate)
|
DATE
|
||||||
@*@Html.DisplayNameFor(model => model.SequenceNumber)*@
|
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.BuyerId)
|
TOTAL
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.OrderDate)
|
STATUS
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -36,18 +35,15 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.OrderDate)
|
@Html.DisplayFor(modelItem => item.OrderDate)
|
||||||
@*@Html.DisplayFor(modelItem => item.SequenceNumber)*@
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.BuyerId)
|
$ @item.Total()
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.OrderDate)
|
@Html.DisplayFor(modelItem => item.State)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="order-detail-button">
|
||||||
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
|
<a asp-controller="Order" asp-action="Detail" asp-route-orderId="@item.Id">Detail</a>
|
||||||
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
|
|
||||||
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
@model Microsoft.eShopOnContainers.WebMVC.Models.Order
|
@model System.Int32
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "My Cart";
|
ViewData["Title"] = "My Cart";
|
||||||
}
|
}
|
||||||
|
|
||||||
@foreach (var item in Model.OrderItems)
|
<div>
|
||||||
{
|
<a asp-area="" asp-controller="Cart" asp-action="Index"><img src="~/images/cart.PNG" class="fr layout-cart-image hidden-xs" />
|
||||||
<tr>
|
|
||||||
<td>@*image*@</td>
|
</a>
|
||||||
<td>@item.ProductName</td>
|
<div class="layout-cart-badge">
|
||||||
<td>ROSLYN</td>
|
@Model
|
||||||
<td>$ @item.UnitPrice</td>
|
</div>
|
||||||
<td>@item.Quantity</td>
|
</div>
|
||||||
<td>$ @item.Quantity * @item.UnitPrice</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "My Cart";
|
||||||
|
}
|
||||||
|
|
||||||
|
<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.Items.Count; i++)
|
||||||
|
{
|
||||||
|
var item = Model.Items[i];
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="cart-product-column"><img class="cart-product-image" src="@item.PictureUrl" /></td>
|
||||||
|
<td class="cart-product-column">@item.ProductName</td>
|
||||||
|
<td class="cart-product-column">ROSLYN</td>
|
||||||
|
<td class="cart-product-column">$ @item.UnitPrice</td>
|
||||||
|
<td class="cart-product-column">
|
||||||
|
<input type="hidden" name="@("quantities[" + i +"].Key")" value="@item.Id" />
|
||||||
|
<input type="number" name="@("quantities[" + i +"].Value")" value="@item.Quantity" />
|
||||||
|
</td>
|
||||||
|
<td class="cart-product-column cart-total-value">$ @(item.Quantity * item.UnitPrice)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-offset-8 col-md-4">
|
||||||
|
<input type="submit"
|
||||||
|
class="btn btn-default cart-refresh-button"
|
||||||
|
value=""
|
||||||
|
name="action" />
|
||||||
|
<div class="cart-section-total">
|
||||||
|
@*<div class="cart-subtotal-label"><span>SUBTOTAL</span></div>
|
||||||
|
<div class="cart-subtotal-value"><span>$ @Model.Total()</span></div>
|
||||||
|
<div class="cart-subtotal-label"><span>TAX</span></div>
|
||||||
|
<div class="cart-subtotal-value"><span>$ 4.20</span></div>*@
|
||||||
|
<div class="cart-total-label"><span>TOTAL</span></div>
|
||||||
|
<div class="cart-total-value"><span>$ @Model.Total()</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
@ -17,17 +17,11 @@
|
|||||||
</environment>
|
</environment>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<div class="navbar navbar-inverse navbar-fixed-top es-header">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="navbar-header col-sm-8 col-xs-8">
|
<div class="navbar-header col-sm-8 col-xs-8">
|
||||||
@*<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<a asp-area="" asp-controller="Catalog" asp-action="Index">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>*@
|
|
||||||
<a asp-area="" asp-controller="Home" asp-action="Index">
|
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -7,17 +7,21 @@
|
|||||||
@if (SignInManager.IsSignedIn(User))
|
@if (SignInManager.IsSignedIn(User))
|
||||||
{
|
{
|
||||||
<form asp-area="" asp-controller="Account" asp-action="LogOff" method="post" id="logoutForm" class="navbar-right">
|
<form asp-area="" asp-controller="Account" asp-action="LogOff" method="post" id="logoutForm" class="navbar-right">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<div class="nav navbar-nav navbar-right mt-15">
|
||||||
<li style="float:right"><a asp-area="" asp-controller="Order" asp-action="Cart"><img src="~/images/cart.PNG" class="layout-cart-image hidden-xs"></a></li>
|
@await Component.InvokeAsync("Cart", new { user = await UserManager.GetUserAsync(User) })
|
||||||
<li class="fr"><a href="javascript:document.getElementById('logoutForm').submit()" class="btn-login"> Log Out </a></li>
|
<div class="fr login-user">
|
||||||
@*<li class="fr login-user"><a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage">@UserManager.GetUserName(User)</a></li>*@
|
<span>@UserManager.GetUserName(User)<i class="down-arrow"></i></span>
|
||||||
</ul>
|
<div class="login-user-dropdown-content">
|
||||||
|
<a asp-controller="Order" asp-action="Index">MY ORDERS<i class="myorders-icon"></i></a>
|
||||||
|
<a href="javascript:document.getElementById('logoutForm').submit()">LOG OUT<i class="logout-icon"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li><a asp-area="" asp-controller="Account" class="btn-login" asp-action="Login"> Log In </a></li>
|
<li><a asp-area="" asp-controller="Account" class="btn-login" asp-action="Login"> Log In </a></li>
|
||||||
<li><a asp-area="" asp-controller="Order" asp-action="Cart"><img src="~/images/cart.PNG" class="layout-cart-image hidden-xs"></a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Microsoft.eShopOnContainers.WebMVC-946ae052-8305-4a99-965b-ec8636ddbae3;Trusted_Connection=True;MultipleActiveResultSets=true;"
|
//"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-Microsoft.eShopOnContainers.WebMVC-946ae052-8305-4a99-965b-ec8636ddbae3;Trusted_Connection=True;MultipleActiveResultSets=true;"
|
||||||
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=aspnet-Microsoft.eShopOnContainers.WebMVC;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;Trusted_Connection=True;"
|
"DefaultConnection": "Server=.;Database=aspnet-Microsoft.eShopOnContainers.WebMVC;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;Trusted_Connection=True;"
|
||||||
},
|
},
|
||||||
"CatalogUrl": "http://localhost:56986/",
|
"CatalogUrl": "http://localhost:56986/",
|
||||||
"OrderingUrl": "http://localhost:2446/",
|
"OrderingUrl": "http://localhost:2446/",
|
||||||
@ -14,5 +14,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Data Source=tcp:eshoponcontainerswebmvc2016dbserver.database.windows.net,1433;Initial Catalog=eShopOnContainersWebMVC2016_db;User Id=eshoponcontainerswebmvc2016dbserver@eshoponcontainerswebmvc2016dbserver;Password=Patata.123
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
|
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
|
||||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
|
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
|
||||||
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Session": "1.0.0",
|
||||||
"Microsoft.AspNetCore.Razor.Tools": {
|
"Microsoft.AspNetCore.Razor.Tools": {
|
||||||
"version": "1.0.0-preview2-final",
|
"version": "1.0.0-preview2-final",
|
||||||
"type": "build"
|
"type": "build"
|
||||||
|
@ -16,6 +16,10 @@ body {
|
|||||||
font-family: Montserrat,sans-serif;
|
font-family: Montserrat,sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mt-15 {
|
||||||
|
margin-top:15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Wrapping element */
|
/* Wrapping element */
|
||||||
/* Set some basic padding to keep content from hitting the edges */
|
/* Set some basic padding to keep content from hitting the edges */
|
||||||
.body-content {
|
.body-content {
|
||||||
@ -37,13 +41,17 @@ textarea {
|
|||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
color: white;
|
color: white;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 3px;
|
||||||
min-width: 120px;
|
min-width: 140px;
|
||||||
border-color: #37c7ca;
|
border-color: #37c7ca;
|
||||||
max-height: 43px;
|
max-height: 43px;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select-filter option {
|
||||||
|
background-color: #00a69c;
|
||||||
|
}
|
||||||
|
|
||||||
select::-ms-expand {
|
select::-ms-expand {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -62,13 +70,13 @@ select::-ms-expand {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-left: 25px;
|
margin-left: 21px;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-filter-arrow {
|
.select-filter-arrow {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left: 110px;
|
margin-left: 130px;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +97,20 @@ select::-ms-expand {
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-cart-badge {
|
||||||
|
position: absolute;
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-left: 14px;
|
||||||
|
background-color: #83d01b;
|
||||||
|
padding: 1px;
|
||||||
|
color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
font-size: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/* buttons and links extension to use brackets: [ click me ] */
|
/* buttons and links extension to use brackets: [ click me ] */
|
||||||
.btn-bracketed:hover:before {
|
.btn-bracketed:hover:before {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -179,6 +201,13 @@ select::-ms-expand {
|
|||||||
|
|
||||||
.btn-cart {
|
.btn-cart {
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-catalog-apply {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-top: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
@ -299,6 +328,7 @@ select::-ms-expand {
|
|||||||
|
|
||||||
.home-catalog-container {
|
.home-catalog-container {
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-catalog-filter-container {
|
.home-catalog-filter-container {
|
||||||
@ -409,7 +439,11 @@ footer {
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
form .text {
|
.text {
|
||||||
|
color: #83D01B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text:hover {
|
||||||
color: #83D01B;
|
color: #83D01B;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,8 +509,76 @@ form .col-md-4 {
|
|||||||
.cart-index-container {
|
.cart-index-container {
|
||||||
min-height: 70vh;
|
min-height: 70vh;
|
||||||
padding-top: 40px;
|
padding-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-create-container {
|
||||||
|
min-height: 70vh;
|
||||||
|
padding-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-product-column {
|
||||||
|
max-width: 120px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
vertical-align: middle!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-subtotal-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #404040;
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-subtotal-value {
|
||||||
|
font-size: 20px;
|
||||||
|
color: #00a69c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-total-label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #404040;
|
||||||
|
margin-top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-total-value {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #00a69c;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-product-image {
|
||||||
|
max-width: 210px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-section-total {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-left: 175px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-product-column input {
|
||||||
|
width: 70px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-refresh-button {
|
||||||
|
margin-top:0;
|
||||||
|
background-image: url('../images/refresh.svg');
|
||||||
|
color: white;
|
||||||
|
font-size: 8px;
|
||||||
|
width: 40px;
|
||||||
|
margin-top: 10px;
|
||||||
|
height: 40px;
|
||||||
|
background-color:transparent;
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-refresh-button:hover {
|
||||||
|
background-color:transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.input-validation-error {
|
.input-validation-error {
|
||||||
border: 1px solid #fb0d0d;
|
border: 1px solid #fb0d0d;
|
||||||
}
|
}
|
||||||
@ -502,25 +604,192 @@ form .col-md-4 {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-index-container {
|
||||||
|
min-height: 70vh;
|
||||||
|
padding-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-index-container .table tbody tr {
|
||||||
|
border-bottom:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-index-container .table tbody tr td {
|
||||||
|
border-top:none;
|
||||||
|
padding-top:10px;
|
||||||
|
padding-bottom:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.order-index-container .table tbody tr:nth-child(even) {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
.order-create-section-title {
|
.order-create-section-title {
|
||||||
margin-left: -15px;
|
margin-left: -15px;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-create-section-items {
|
.order-create-section-items {
|
||||||
margin-left: -30px;
|
margin-left: -45px;
|
||||||
|
width: 102%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-button {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-button a {
|
||||||
|
color: #83d01b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-container {
|
||||||
|
min-height: 70vh;
|
||||||
|
padding-top: 40px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-container .table tbody tr:first-child td{
|
||||||
|
border-top:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-container .table tr{
|
||||||
|
border-bottom:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-section {
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-detail-container .table {
|
||||||
|
margin-left: -7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-section-total {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-left: 20px;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fr {
|
.fr {
|
||||||
float:right!important;
|
float:right!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.down-arrow {
|
||||||
|
background-image: url('../images/arrow-down.png');
|
||||||
|
height: 7px;
|
||||||
|
width: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-icon {
|
||||||
|
background-image: url('../images/logout.PNG');
|
||||||
|
display: inline-block;
|
||||||
|
height:19px;
|
||||||
|
width:19px;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myorders-icon {
|
||||||
|
background-image: url('../images/my_orders.PNG');
|
||||||
|
display: inline-block;
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
.login-user {
|
.login-user {
|
||||||
position: absolute!important;
|
position: absolute!important;
|
||||||
top: 40px;
|
top: 30px;
|
||||||
right: 65px;
|
right: 65px;
|
||||||
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-user-dropdown {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-user-dropdown-content {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
min-width: 160px;
|
||||||
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||||
|
left: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-user-dropdown-content a {
|
||||||
|
color: black;
|
||||||
|
padding: 12px 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
display: block;
|
||||||
|
text-align:right;
|
||||||
|
text-transform:uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-user:hover .login-user-dropdown-content {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-user-dropdown-content a:hover {
|
||||||
|
color: #83d01b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.es-header {
|
||||||
|
min-height: 80px!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.es-pager-bottom {
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.es-pager-top {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.es-pager-top ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.es-pager-bottom ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.previous {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-disabled{
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: .5;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tr {
|
||||||
|
border-bottom:1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Hide/rearrange for smaller screens */
|
/* Hide/rearrange for smaller screens */
|
||||||
@media screen and (max-width: 767px) {
|
@media screen and (max-width: 767px) {
|
||||||
/* Hide captions */
|
/* Hide captions */
|
||||||
|
2
src/Web/WebMVC/wwwroot/css/site.min.css
vendored
2
src/Web/WebMVC/wwwroot/css/site.min.css
vendored
File diff suppressed because one or more lines are too long
BIN
src/Web/WebMVC/wwwroot/images/logout.PNG
Normal file
BIN
src/Web/WebMVC/wwwroot/images/logout.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 429 B |
BIN
src/Web/WebMVC/wwwroot/images/my_orders.PNG
Normal file
BIN
src/Web/WebMVC/wwwroot/images/my_orders.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
44
src/Web/WebMVC/wwwroot/images/refresh.svg
Normal file
44
src/Web/WebMVC/wwwroot/images/refresh.svg
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 259.244 259.244" style="enable-background:new 0 0 259.244 259.244;" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<path style="fill:#3DB39E;" d="M248.348,129.3h-15.849C232.41,65.277,180.831,13.394,117.202,13.394
|
||||||
|
c-31.841,0-60.661,12.998-81.534,33.996C14.017,68.549,0.25,97.092,0.036,129.3H0l0.018,0.331L0,130.033h0.036
|
||||||
|
c0.393,63.853,51.758,115.816,115.19,115.816c31.841,0,60.661-13.007,81.534-34.049l-25.852-24.931
|
||||||
|
c-14.178,14.303-34.058,23.027-55.682,23.135c-44.401,0.206-79.201-36.49-79.201-80.122c-0.107-22.893,10.092-42.908,25.486-57.595
|
||||||
|
c14.186-14.285,34.058-23.001,55.691-23.108c44.41-0.206,79.201,36.445,79.201,79.997v0.125h-15.661
|
||||||
|
c-9.708,0-13.668,6.499-8.814,14.41l33.799,33.433c7.732,7.732,9.967,7.661,17.646,0l33.799-33.433
|
||||||
|
C262.025,135.781,258.056,129.3,248.348,129.3z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user