diff --git a/src/Web/WebMVC/Controllers/AccountController.cs b/src/Web/WebMVC/Controllers/AccountController.cs index f48b6e884..c76e6eabc 100644 --- a/src/Web/WebMVC/Controllers/AccountController.cs +++ b/src/Web/WebMVC/Controllers/AccountController.cs @@ -151,7 +151,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { await _signInManager.SignOutAsync(); _logger.LogInformation(4, "User logged out."); - return RedirectToAction(nameof(HomeController.Index), "Home"); + return RedirectToAction(nameof(CatalogController.Index), "Catalog"); } // @@ -476,7 +476,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers } else { - return RedirectToAction(nameof(HomeController.Index), "Home"); + return RedirectToAction(nameof(CatalogController.Index), "Catalog"); } } diff --git a/src/Web/WebMVC/Controllers/CatalogController.cs b/src/Web/WebMVC/Controllers/CatalogController.cs new file mode 100644 index 000000000..e04c86be9 --- /dev/null +++ b/src/Web/WebMVC/Controllers/CatalogController.cs @@ -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 Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page) + { + var vm = new IndexViewModel() + { + CatalogItems = await _catalogSvc.GetCatalogItems(8 * (page ?? 0), 8), + Brands = _catalogSvc.GetTypes(), + Types = _catalogSvc.GetBrands(), + BrandFilterApplied = BrandFilterApplied ?? 0, + TypesFilterApplied = TypesFilterApplied ?? 0, + PaginationInfo = new PaginationInfo() + { + ActualPage = page ?? 0, + ItemsPerPage = 8, + TotalItems = _catalogSvc.TotalItems, + TotalPages = int.Parse(Math.Round(((decimal)_catalogSvc.TotalItems / 8), 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(); + } + } +} + diff --git a/src/Web/WebMVC/Controllers/HomeController.cs b/src/Web/WebMVC/Controllers/HomeController.cs deleted file mode 100644 index 402243dae..000000000 --- a/src/Web/WebMVC/Controllers/HomeController.cs +++ /dev/null @@ -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 options, ICatalogService catalogSvc) - { - _http = new HttpClient(); - _settings = options.Value; - _catalogSvc = catalogSvc; - } - public async Task Index() - { - //var dataString = await _http.GetStringAsync(_settings.CatalogUrl); - //var items = JsonConvert.DeserializeObject>(dataString); - //items.AddRange(items); - var items = await _catalogSvc.GetCatalogItems(); - var vm = new IndexViewModel() - { - CatalogItems = items - }; - return View(vm); - } - - public async Task Orders() - { - ViewData["Message"] = "Orders page."; - - var ordersUrl = _settings.OrderingUrl + "/api/ordering/orders"; - var dataString = await _http.GetStringAsync(ordersUrl); - var items = JsonConvert.DeserializeObject>(dataString); - return View(items); - } - - public IActionResult Error() - { - return View(); - } - } -} diff --git a/src/Web/WebMVC/Controllers/OrderController.cs b/src/Web/WebMVC/Controllers/OrderController.cs index d1818d1e3..f6f785195 100644 --- a/src/Web/WebMVC/Controllers/OrderController.cs +++ b/src/Web/WebMVC/Controllers/OrderController.cs @@ -16,6 +16,11 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers _orderSvc = orderSvc; } + public IActionResult AddToCart() + { + return View(); + } + public IActionResult Cart() { return View(); diff --git a/src/Web/WebMVC/Models/CatalogItem.cs b/src/Web/WebMVC/Models/CatalogItem.cs index 8643fffe9..1a4d7e8e4 100644 --- a/src/Web/WebMVC/Models/CatalogItem.cs +++ b/src/Web/WebMVC/Models/CatalogItem.cs @@ -8,5 +8,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models public string Name { get; set; } public string Description { get; set; } public decimal Price { get; set; } + public string PicsUrl { get; set; } } } \ No newline at end of file diff --git a/src/Web/WebMVC/Models/HomeViewModels/IndexViewModel.cs b/src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs similarity index 65% rename from src/Web/WebMVC/Models/HomeViewModels/IndexViewModel.cs rename to src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs index f5ba57dad..9283c8e59 100644 --- a/src/Web/WebMVC/Models/HomeViewModels/IndexViewModel.cs +++ b/src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs @@ -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.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels +namespace Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels { public class IndexViewModel { @@ -13,5 +14,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels public IEnumerable Types { get; set; } public int BrandFilterApplied { get; set; } public int TypesFilterApplied { get; set; } + public PaginationInfo PaginationInfo { get; set; } } } diff --git a/src/Web/WebMVC/Models/Pagination/PaginationInfo.cs b/src/Web/WebMVC/Models/Pagination/PaginationInfo.cs new file mode 100644 index 000000000..3baffa560 --- /dev/null +++ b/src/Web/WebMVC/Models/Pagination/PaginationInfo.cs @@ -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; } + } +} diff --git a/src/Web/WebMVC/Services/CartService.cs b/src/Web/WebMVC/Services/CartService.cs index aeb59cfaa..13cc1f627 100644 --- a/src/Web/WebMVC/Services/CartService.cs +++ b/src/Web/WebMVC/Services/CartService.cs @@ -28,7 +28,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services throw new NotImplementedException(); } - public Task GetOrderInProgress() + public Task GetActiveOrder() { return Task.Run(() => { return _order; }); } diff --git a/src/Web/WebMVC/Services/CatalogService.cs b/src/Web/WebMVC/Services/CatalogService.cs index 0a600747e..b2416a9de 100644 --- a/src/Web/WebMVC/Services/CatalogService.cs +++ b/src/Web/WebMVC/Services/CatalogService.cs @@ -3,21 +3,65 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; 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 { public class CatalogService : ICatalogService { - List _items; + private readonly List _items; //Fake data while services are ready. + private readonly IOptions _settings; + private HttpClient _apiClient; + private readonly string _remoteServiceBaseUrl; + private int _totalItems; - public CatalogService() { + public int TotalItems + { + get + { + return _totalItems; + } + } + + public CatalogService(IOptions settings) { + _settings = settings; + + #region fake data _items = new List() { - new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12 }, - new CatalogItem() { Id = Guid.NewGuid(), Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17 }, - new CatalogItem() { Id = Guid.NewGuid(), Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12 }, - 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(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, + new CatalogItem() { Id = Guid.NewGuid(), Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PicsUrl = "http://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, PicsUrl = "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, PicsUrl = "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"), PicsUrl = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" } }; + #endregion } public CatalogItem GetCatalogItem(Guid Id) @@ -25,9 +69,37 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services return _items.Where(x => x.Id == Id).FirstOrDefault(); } - public Task> GetCatalogItems() + public Task> 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 GetBrands() + { + var items = new List(); + 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 GetTypes() + { + var items = new List(); + 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; } } } diff --git a/src/Web/WebMVC/Services/ICartService.cs b/src/Web/WebMVC/Services/ICartService.cs index 233dea570..8705ab2dc 100644 --- a/src/Web/WebMVC/Services/ICartService.cs +++ b/src/Web/WebMVC/Services/ICartService.cs @@ -11,6 +11,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services void AddItemToOrder(CatalogItem item); void RemoveItemFromOrder(Guid itemIdentifier); int GetItemCountFromOrderInProgress(); - Task GetOrderInProgress(); + Task GetActiveOrder(); } } diff --git a/src/Web/WebMVC/Services/ICatalogService.cs b/src/Web/WebMVC/Services/ICatalogService.cs index bf6b90ff7..50f2f9f54 100644 --- a/src/Web/WebMVC/Services/ICatalogService.cs +++ b/src/Web/WebMVC/Services/ICatalogService.cs @@ -1,4 +1,5 @@ -using Microsoft.eShopOnContainers.WebMVC.Models; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.eShopOnContainers.WebMVC.Models; using System; using System.Collections.Generic; using System.Linq; @@ -8,7 +9,11 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services { public interface ICatalogService { - Task> GetCatalogItems(); + int TotalItems { get; } + + Task> GetCatalogItems(int? skip, int? take); CatalogItem GetCatalogItem(Guid Id); + IEnumerable GetBrands(); + IEnumerable GetTypes(); } } diff --git a/src/Web/WebMVC/Services/OrderingService.cs b/src/Web/WebMVC/Services/OrderingService.cs index 06ae93b1d..c9f2c3eb6 100644 --- a/src/Web/WebMVC/Services/OrderingService.cs +++ b/src/Web/WebMVC/Services/OrderingService.cs @@ -9,6 +9,9 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services public class OrderingService : IOrderingService { private List _orders; + //var ordersUrl = _settings.OrderingUrl + "/api/ordering/orders"; + //var dataString = await _http.GetStringAsync(ordersUrl); + //var items = JsonConvert.DeserializeObject>(dataString); public OrderingService() { diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index dbf614716..24381c2f2 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -22,7 +22,8 @@ namespace Microsoft.eShopOnContainers.WebMVC var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); if (env.IsDevelopment()) { @@ -73,7 +74,7 @@ namespace Microsoft.eShopOnContainers.WebMVC } else { - app.UseExceptionHandler("/Home/Error"); + app.UseExceptionHandler("/Catalog/Error"); } app.UseStaticFiles(); @@ -86,7 +87,7 @@ namespace Microsoft.eShopOnContainers.WebMVC { routes.MapRoute( name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + template: "{controller=Catalog}/{action=Index}/{id?}"); }); } } diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/CartList.cs similarity index 82% rename from src/Web/WebMVC/ViewComponents/Cart.cs rename to src/Web/WebMVC/ViewComponents/CartList.cs index dd59738bf..0e56ddd0a 100644 --- a/src/Web/WebMVC/ViewComponents/Cart.cs +++ b/src/Web/WebMVC/ViewComponents/CartList.cs @@ -8,11 +8,11 @@ using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { - public class Cart : ViewComponent + public class CartList : ViewComponent { private readonly ICartService _cartSvc; - public Cart(ICartService cartSvc) + public CartList(ICartService cartSvc) { _cartSvc = cartSvc; } @@ -24,7 +24,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents } private Task GetItemsAsync() { - return _cartSvc.GetOrderInProgress(); + return _cartSvc.GetActiveOrder(); } } } diff --git a/src/Web/WebMVC/Views/Catalog/Index.cshtml b/src/Web/WebMVC/Views/Catalog/Index.cshtml new file mode 100644 index 000000000..d701b3f7e --- /dev/null +++ b/src/Web/WebMVC/Views/Catalog/Index.cshtml @@ -0,0 +1,110 @@ +@{ + ViewData["Title"] = "Catalog"; + @model Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels.IndexViewModel +} + +
+
+
+
+ +
+
+
+
+ + +
+
+ + +
+ +
+
+
+
+ +
+
+
+
+ +
+
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)
+
+ +
+
+
+
+ @foreach (var catalogItem in Model.CatalogItems) + { +
+ +
+ @catalogItem.Name +
+
+ @catalogItem.Price.ToString("N2") +
+
+ } +
+
+
+
+ +
+
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)
+
+ +
+
+
+
diff --git a/src/Web/WebMVC/Views/Home/Orders.cshtml b/src/Web/WebMVC/Views/Catalog/Orders.cshtml similarity index 100% rename from src/Web/WebMVC/Views/Home/Orders.cshtml rename to src/Web/WebMVC/Views/Catalog/Orders.cshtml diff --git a/src/Web/WebMVC/Views/Home/Index.cshtml b/src/Web/WebMVC/Views/Home/Index.cshtml deleted file mode 100644 index 792599621..000000000 --- a/src/Web/WebMVC/Views/Home/Index.cshtml +++ /dev/null @@ -1,67 +0,0 @@ -@{ - ViewData["Title"] = "Home Page"; - @model Microsoft.eShopOnContainers.WebMVC.Models.HomeViewModels.IndexViewModel -} - -
-
-
-
- -
-
- @* - *@ -
- - -
-
- - -
- - APPLY - -
-
-
- -
-
- @foreach (var catalogItem in Model.CatalogItems) - { -
- -
- @catalogItem.Name -
-
- @catalogItem.Price.ToString("N2") -
-
- } -
-
- diff --git a/src/Web/WebMVC/Views/Order/Cart.cshtml b/src/Web/WebMVC/Views/Order/Cart.cshtml index afbb48436..ab497fe9c 100644 --- a/src/Web/WebMVC/Views/Order/Cart.cshtml +++ b/src/Web/WebMVC/Views/Order/Cart.cshtml @@ -6,14 +6,11 @@
-



@@ -41,7 +38,7 @@ - @await Component.InvokeAsync("Cart") + @await Component.InvokeAsync("CartList")
diff --git a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml index ccd1a7f7f..55acc63b1 100644 --- a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml +++ b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml @@ -4,17 +4,7 @@ ViewData["Title"] = "My Cart"; } -@foreach (var item in Model.OrderItems) -{ - - @*image*@ - @item.ProductName - ROSLYN - $ @item.UnitPrice - @item.Quantity - $ @item.Quantity * @item.UnitPrice - -} + diff --git a/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml new file mode 100644 index 000000000..ccd1a7f7f --- /dev/null +++ b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml @@ -0,0 +1,20 @@ +@model Microsoft.eShopOnContainers.WebMVC.Models.Order + +@{ + ViewData["Title"] = "My Cart"; +} + +@foreach (var item in Model.OrderItems) +{ + + @*image*@ + @item.ProductName + ROSLYN + $ @item.UnitPrice + @item.Quantity + $ @item.Quantity * @item.UnitPrice + +} + + + diff --git a/src/Web/WebMVC/Views/Shared/_Layout.cshtml b/src/Web/WebMVC/Views/Shared/_Layout.cshtml index ab274a9ad..2c3c6f982 100644 --- a/src/Web/WebMVC/Views/Shared/_Layout.cshtml +++ b/src/Web/WebMVC/Views/Shared/_Layout.cshtml @@ -17,17 +17,11 @@ -