diff --git a/src/Web/Controllers/AccountController.cs b/src/Web/Controllers/AccountController.cs index 7a9c89152..1a9541bb5 100644 --- a/src/Web/Controllers/AccountController.cs +++ b/src/Web/Controllers/AccountController.cs @@ -89,7 +89,7 @@ private IActionResult RedirectToLocal(string returnUrl) } else { - return RedirectToAction(nameof(CatalogController.Index), "Home"); + return RedirectToAction(nameof(CatalogController.Index), "Catalog"); } } diff --git a/src/Web/Controllers/CatalogController.cs b/src/Web/Controllers/CatalogController.cs index 89ebf2fcc..0be47cdd2 100644 --- a/src/Web/Controllers/CatalogController.cs +++ b/src/Web/Controllers/CatalogController.cs @@ -56,21 +56,21 @@ public async Task Index(int? brandFilterApplied, int? typesFilter return View(vm); } - [HttpGet("[controller]/pic/{id}")] - public IActionResult GetImage(int id) - { - byte[] imageBytes; - try - { - imageBytes = _imageService.GetImageBytesById(id); - } - catch (CatalogImageMissingException ex) - { - _logger.LogWarning($"No image found for id: {id}"); - return NotFound(); - } - return File(imageBytes, "image/png"); - } + //[HttpGet("[controller]/pic/{id}")] + //public IActionResult GetImage(int id) + //{ + // byte[] imageBytes; + // try + // { + // imageBytes = _imageService.GetImageBytesById(id); + // } + // catch (CatalogImageMissingException ex) + // { + // _logger.LogWarning($"No image found for id: {id}"); + // return NotFound(); + // } + // return File(imageBytes, "image/png"); + //} public IActionResult Error() diff --git a/src/Web/Infrastructure/CatalogContextSeed.cs b/src/Web/Infrastructure/CatalogContextSeed.cs index 4e6af8bd1..ec7034c7d 100644 --- a/src/Web/Infrastructure/CatalogContextSeed.cs +++ b/src/Web/Infrastructure/CatalogContextSeed.cs @@ -85,18 +85,18 @@ static IEnumerable GetPreconfiguredItems() { return new List() { - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = 19.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/1" }, - new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/2" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/3" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation Sweatshirt", Name = ".NET Foundation Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/4" }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/5" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Sweatshirt", Name = ".NET Blue Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/6" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/7" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Sweatshirt", Name = "Kudu Purple Sweatshirt", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/8" }, - new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup White Mug", Name = "Cup White Mug", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/9" }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/10" }, - new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup Sheet", Name = "Cup Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/11" }, - new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/12" } + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = 19.5M, PictureUri = "http://catalogbaseurltobereplaced/images/products/1.png" }, + new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://catalogbaseurltobereplaced/images/products/2.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/3.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation Sweatshirt", Name = ".NET Foundation Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/4.png" }, + new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/images/products/5.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Sweatshirt", Name = ".NET Blue Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/6.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/7.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Sweatshirt", Name = "Kudu Purple Sweatshirt", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/images/products/8.png" }, + new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup White Mug", Name = "Cup White Mug", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/9.png" }, + new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/10.png" }, + new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup Sheet", Name = "Cup Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/images/products/11.png" }, + new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/images/products/12.png" } }; } } diff --git a/src/Web/Program.cs b/src/Web/Program.cs index 10565bda4..b8c01c5b8 100644 --- a/src/Web/Program.cs +++ b/src/Web/Program.cs @@ -1,5 +1,6 @@ using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; namespace Microsoft.eShopWeb { @@ -11,6 +12,11 @@ public static void Main(string[] args) .UseKestrel() .UseUrls("http://0.0.0.0:5106") .UseContentRoot(Directory.GetCurrentDirectory()) + .ConfigureLogging(factory => + { + factory.AddConsole(LogLevel.Warning); + factory.AddDebug(); + }) .UseIISIntegration() .UseStartup() .UseApplicationInsights() diff --git a/src/Web/Properties/launchSettings.json b/src/Web/Properties/launchSettings.json index 7dbd49189..d83765d55 100644 --- a/src/Web/Properties/launchSettings.json +++ b/src/Web/Properties/launchSettings.json @@ -21,7 +21,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://localhost:58299" + "applicationUrl": "http://localhost:5106" } } } diff --git a/src/Web/Startup.cs b/src/Web/Startup.cs index 7c2f2edb8..c73723cdd 100644 --- a/src/Web/Startup.cs +++ b/src/Web/Startup.cs @@ -14,6 +14,7 @@ using ApplicationCore.Interfaces; using Infrastructure.FileSystem; using Infrastructure.Logging; +using Microsoft.AspNetCore.Identity; namespace Microsoft.eShopWeb { @@ -41,8 +42,8 @@ public void ConfigureServices(IServiceCollection services) { try { - //c.UseInMemoryDatabase("Catalog"); - c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")); + c.UseInMemoryDatabase("Catalog"); + //c.UseSqlServer(Configuration.GetConnectionString("CatalogConnection")); c.ConfigureWarnings(wb => { //By default, in this application, we don't want to have client evaluations @@ -57,8 +58,8 @@ public void ConfigureServices(IServiceCollection services) // Add Identity DbContext services.AddDbContext(options => - //options.UseInMemoryDatabase("Identity")); - options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection"))); + options.UseInMemoryDatabase("Identity")); + //options.UseSqlServer(Configuration.GetConnectionString("IdentityConnection"))); services.AddIdentity() .AddEntityFrameworkStores() @@ -76,11 +77,11 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, + IHostingEnvironment env, + ILoggerFactory loggerFactory, + UserManager userManager) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); @@ -124,6 +125,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF //Seed Data CatalogContextSeed.SeedAsync(app, loggerFactory) .Wait(); + + var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" }; + userManager.CreateAsync(defaultUser, "Pass@word1").Wait(); } } } diff --git a/src/Web/Views/Account/Signin.cshtml b/src/Web/Views/Account/Signin.cshtml index 09f8aee6f..dc5b3f8d6 100644 --- a/src/Web/Views/Account/Signin.cshtml +++ b/src/Web/Views/Account/Signin.cshtml @@ -7,7 +7,7 @@ }
@@ -15,7 +15,7 @@
-
+

ARE YOU REGISTERED?

diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index 745b30ed6..c4ecf1c35 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -41,5 +41,24 @@ + + + + + + + + + + + + + + + + + Always + + diff --git a/src/Web/appsettings.json b/src/Web/appsettings.json index 44433feb2..c54ac996a 100644 --- a/src/Web/appsettings.json +++ b/src/Web/appsettings.json @@ -8,7 +8,8 @@ "IncludeScopes": false, "LogLevel": { "Default": "Warning", - "Microsoft" : "Warning" + "Microsoft": "Warning", + "System": "Warning" } } } diff --git a/src/Web/Pics/1.png b/src/Web/wwwroot/images/products/1.png similarity index 100% rename from src/Web/Pics/1.png rename to src/Web/wwwroot/images/products/1.png diff --git a/src/Web/Pics/10.png b/src/Web/wwwroot/images/products/10.png similarity index 100% rename from src/Web/Pics/10.png rename to src/Web/wwwroot/images/products/10.png diff --git a/src/Web/Pics/11.png b/src/Web/wwwroot/images/products/11.png similarity index 100% rename from src/Web/Pics/11.png rename to src/Web/wwwroot/images/products/11.png diff --git a/src/Web/Pics/12.png b/src/Web/wwwroot/images/products/12.png similarity index 100% rename from src/Web/Pics/12.png rename to src/Web/wwwroot/images/products/12.png diff --git a/src/Web/Pics/2.png b/src/Web/wwwroot/images/products/2.png similarity index 100% rename from src/Web/Pics/2.png rename to src/Web/wwwroot/images/products/2.png diff --git a/src/Web/Pics/3.png b/src/Web/wwwroot/images/products/3.png similarity index 100% rename from src/Web/Pics/3.png rename to src/Web/wwwroot/images/products/3.png diff --git a/src/Web/Pics/4.png b/src/Web/wwwroot/images/products/4.png similarity index 100% rename from src/Web/Pics/4.png rename to src/Web/wwwroot/images/products/4.png diff --git a/src/Web/Pics/5.png b/src/Web/wwwroot/images/products/5.png similarity index 100% rename from src/Web/Pics/5.png rename to src/Web/wwwroot/images/products/5.png diff --git a/src/Web/Pics/6.png b/src/Web/wwwroot/images/products/6.png similarity index 100% rename from src/Web/Pics/6.png rename to src/Web/wwwroot/images/products/6.png diff --git a/src/Web/Pics/7.png b/src/Web/wwwroot/images/products/7.png similarity index 100% rename from src/Web/Pics/7.png rename to src/Web/wwwroot/images/products/7.png diff --git a/src/Web/Pics/8.png b/src/Web/wwwroot/images/products/8.png similarity index 100% rename from src/Web/Pics/8.png rename to src/Web/wwwroot/images/products/8.png diff --git a/src/Web/Pics/9.png b/src/Web/wwwroot/images/products/9.png similarity index 100% rename from src/Web/Pics/9.png rename to src/Web/wwwroot/images/products/9.png