More products and images in Catalog Seed
| @ -6,6 +6,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers | |||||||
|     using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; |     using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; | ||||||
|     using Model; |     using Model; | ||||||
|     using System; |     using System; | ||||||
|  |     using System.Collections.Generic; | ||||||
|     using System.Linq; |     using System.Linq; | ||||||
|     using System.Threading.Tasks; |     using System.Threading.Tasks; | ||||||
|     using ViewModel; |     using ViewModel; | ||||||
| @ -56,6 +57,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers | |||||||
|                 .Take(pageSize) |                 .Take(pageSize) | ||||||
|                 .ToListAsync(); |                 .ToListAsync(); | ||||||
| 
 | 
 | ||||||
|  |             itemsOnPage = ComposePicUri(itemsOnPage); | ||||||
|  | 
 | ||||||
|             var model = new PaginatedItemsViewModel<CatalogItem>( |             var model = new PaginatedItemsViewModel<CatalogItem>( | ||||||
|                 pageIndex, pageSize, totalItems, itemsOnPage); |                 pageIndex, pageSize, totalItems, itemsOnPage); | ||||||
| 
 | 
 | ||||||
| @ -87,6 +90,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers | |||||||
|                 .Take(pageSize) |                 .Take(pageSize) | ||||||
|                 .ToListAsync(); |                 .ToListAsync(); | ||||||
| 
 | 
 | ||||||
|  |             itemsOnPage = ComposePicUri(itemsOnPage); | ||||||
|  | 
 | ||||||
|             var model = new PaginatedItemsViewModel<CatalogItem>( |             var model = new PaginatedItemsViewModel<CatalogItem>( | ||||||
|                 pageIndex, pageSize, totalItems, itemsOnPage); |                 pageIndex, pageSize, totalItems, itemsOnPage); | ||||||
|              |              | ||||||
| @ -114,5 +119,14 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers | |||||||
| 
 | 
 | ||||||
|             return Ok(items); |             return Ok(items); | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         private List<CatalogItem> ComposePicUri(List<CatalogItem> items) { | ||||||
|  |             items.ForEach(x => | ||||||
|  |             { | ||||||
|  |                 x.PictureUri = x.PictureUri.Replace("localhost", Request.Host.Host); | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|  |             return items; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,32 @@ | |||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  | using Microsoft.AspNetCore.Mvc; | ||||||
|  | using System.IO; | ||||||
|  | using Microsoft.AspNetCore.Hosting; | ||||||
|  | 
 | ||||||
|  | // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 | ||||||
|  | 
 | ||||||
|  | namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers | ||||||
|  | { | ||||||
|  |     [Route("api/v1/[controller]")]
 | ||||||
|  |     public class PicController : Controller | ||||||
|  |     { | ||||||
|  |         private readonly IHostingEnvironment _env; | ||||||
|  |         public PicController(IHostingEnvironment env) | ||||||
|  |         { | ||||||
|  |             _env = env; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [HttpGet("{id}")] | ||||||
|  |         // GET: /<controller>/ | ||||||
|  |         public IActionResult GetImage(int id) | ||||||
|  |         { | ||||||
|  |             var webRoot = _env.WebRootPath; | ||||||
|  |             var path = Path.Combine(webRoot, id + ".png"); | ||||||
|  |             Byte[] b = System.IO.File.ReadAllBytes(path);          | ||||||
|  |             return File(b, "image/png"); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -74,7 +74,7 @@ | |||||||
|             { |             { | ||||||
|                 new CatalogType() { Type = "Mug"}, |                 new CatalogType() { Type = "Mug"}, | ||||||
|                 new CatalogType() { Type = "T-Shirt" }, |                 new CatalogType() { Type = "T-Shirt" }, | ||||||
|                 new CatalogType() { Type = "Backpack" }, |                 new CatalogType() { Type = "Sheet" }, | ||||||
|                 new CatalogType() { Type = "USB Memory Stick" } |                 new CatalogType() { Type = "USB Memory Stick" } | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
| @ -83,10 +83,18 @@ | |||||||
|         { |         { | ||||||
|             return new List<CatalogItem>() |             return new List<CatalogItem>() | ||||||
|             { |             { | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "https://fakeimg.pl/370x240/EEEEEE/000/?text=RoslynRedT-Shirt"  }, |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = 19.5M, PictureUri = "http://localhost:5101/api/v1/pic/1" }, | ||||||
|                 new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = "Cupt Black & White Mug", Name = "Cupt Black & White Mug", Price= 17, PictureUri = "https://fakeimg.pl/370x240/EEEEEE/000/?text=CuptBlack&WhiteMug" }, |                 new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://localhost:5101/api/v1/pic/2" }, | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.PrismWhiteT-Shirt" }, |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/3" }, | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = 19.5M, PictureUri = "http://fakeimg.pl/370x240/EEEEEE/000/?text=.NETBotBlack" }, |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Foundation Sweatshirt", Name = ".NET Foundation Sweatshirt", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/4" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://localhost:5101/api/v1/pic/5" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Blue Sweatshirt", Name = ".NET Blue Sweatshirt", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/6" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/7"  }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Purple Sweatshirt", Name = ".NET Purple Sweatshirt", Price = 8.5M, PictureUri = "http://localhost:5101/api/v1/pic/8" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=1,CatalogBrandId=1, Description = ".NET T White Mug", Name = ".NET T White Mug", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/9" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/10" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = ".NET T Sheet", Name = ".NET T Sheet", Price = 8.5M, PictureUri = "http://localhost:5101/api/v1/pic/11" }, | ||||||
|  |                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=1, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://localhost:5101/api/v1/pic/12" } | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 148 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/10.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 223 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/11.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 212 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/12.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 165 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 41 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/3.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 170 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/4.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 152 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/5.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 226 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/6.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 179 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/7.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 182 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/8.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 167 KiB | 
							
								
								
									
										
											BIN
										
									
								
								src/Services/Catalog/Catalog.API/Pics/9.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 40 KiB | 
| @ -14,8 +14,10 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API | |||||||
|         { |         { | ||||||
|             var host = new WebHostBuilder() |             var host = new WebHostBuilder() | ||||||
|                 .UseKestrel() |                 .UseKestrel() | ||||||
|                 .UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? String.Empty) |                 .UseUrls("http://0.0.0.0:5101") | ||||||
|  |                 .UseIISIntegration() | ||||||
|                 .UseContentRoot(Directory.GetCurrentDirectory()) |                 .UseContentRoot(Directory.GetCurrentDirectory()) | ||||||
|  |                 .UseWebRoot("Pics") | ||||||
|                 .UseStartup<Startup>() |                 .UseStartup<Startup>() | ||||||
|                 .Build(); |                 .Build(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
|     "windowsAuthentication": false, |     "windowsAuthentication": false, | ||||||
|     "anonymousAuthentication": true, |     "anonymousAuthentication": true, | ||||||
|     "iisExpress": { |     "iisExpress": { | ||||||
|       "applicationUrl": "http://localhost:2418/", |       "applicationUrl": "http://localhost:5101", | ||||||
|       "sslPort": 0 |       "sslPort": 0 | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  | |||||||
| @ -1,5 +1,7 @@ | |||||||
| namespace Microsoft.eShopOnContainers.Services.Catalog.API | namespace Microsoft.eShopOnContainers.Services.Catalog.API | ||||||
| { | { | ||||||
|  |     using AspNetCore.Http; | ||||||
|  |     using Extensions.FileProviders; | ||||||
|     using Microsoft.AspNetCore.Builder; |     using Microsoft.AspNetCore.Builder; | ||||||
|     using Microsoft.AspNetCore.Hosting; |     using Microsoft.AspNetCore.Hosting; | ||||||
|     using Microsoft.EntityFrameworkCore; |     using Microsoft.EntityFrameworkCore; | ||||||
| @ -9,6 +11,7 @@ | |||||||
|     using Microsoft.Extensions.DependencyInjection; |     using Microsoft.Extensions.DependencyInjection; | ||||||
|     using Microsoft.Extensions.Logging; |     using Microsoft.Extensions.Logging; | ||||||
|     using System; |     using System; | ||||||
|  |     using System.IO; | ||||||
|     using System.Threading; |     using System.Threading; | ||||||
|     using System.Threading.Tasks; |     using System.Threading.Tasks; | ||||||
| 
 | 
 | ||||||
| @ -85,7 +88,6 @@ | |||||||
|             loggerFactory.AddConsole(Configuration.GetSection("Logging")); |             loggerFactory.AddConsole(Configuration.GetSection("Logging")); | ||||||
|             loggerFactory.AddDebug(); |             loggerFactory.AddDebug(); | ||||||
| 
 | 
 | ||||||
|             // Use frameworks |  | ||||||
|             app.UseCors("CorsPolicy"); |             app.UseCors("CorsPolicy"); | ||||||
| 
 | 
 | ||||||
|             app.UseMvcWithDefaultRoute(); |             app.UseMvcWithDefaultRoute(); | ||||||
|  | |||||||
| @ -7,6 +7,7 @@ | |||||||
|     "Microsoft.AspNetCore.Mvc": "1.0.1", |     "Microsoft.AspNetCore.Mvc": "1.0.1", | ||||||
|     "Microsoft.AspNetCore.Diagnostics": "1.0.0", |     "Microsoft.AspNetCore.Diagnostics": "1.0.0", | ||||||
|     "Microsoft.AspNetCore.Diagnostics.Abstractions": "1.0.0", |     "Microsoft.AspNetCore.Diagnostics.Abstractions": "1.0.0", | ||||||
|  |     "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", | ||||||
|     "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", |     "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", | ||||||
|     "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", |     "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", | ||||||
|     "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", |     "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", | ||||||
|  | |||||||
| @ -41,3 +41,36 @@ body { | |||||||
| select::-ms-expand { | select::-ms-expand { | ||||||
|     display: none; |     display: none; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | @media screen and (min-width: 992px) { | ||||||
|  |     .form-input { | ||||||
|  |         max-width: 360px; | ||||||
|  |         width: 360px; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .form-input { | ||||||
|  |     border-radius: 0; | ||||||
|  |     height: 45px; | ||||||
|  |     padding: 10px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .form-input-small { | ||||||
|  |     max-width: 100px !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .form-input-medium { | ||||||
|  |     width: 150px !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .alert { | ||||||
|  |     padding-left: 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .alert-danger { | ||||||
|  |     background-color: transparent; | ||||||
|  |     border: 0; | ||||||
|  |     color: #FB0D0D; | ||||||
|  |     font-size: 12px; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ | |||||||
| </section> | </section> | ||||||
| 
 | 
 | ||||||
| <div class="container"> | <div class="container"> | ||||||
|  |     <div *ngIf="catalog?.data.length > 0"> | ||||||
|         <esh-pager [model]="paginationInfo" (changed)="onPageChanged($event)"></esh-pager> |         <esh-pager [model]="paginationInfo" (changed)="onPageChanged($event)"></esh-pager> | ||||||
| 
 | 
 | ||||||
|         <div class="esh-catalog-items row"> |         <div class="esh-catalog-items row"> | ||||||
| @ -42,5 +43,9 @@ | |||||||
|         </div> |         </div> | ||||||
| 
 | 
 | ||||||
|         <esh-pager [model]="paginationInfo" (changed)="onPageChanged($event)"></esh-pager> |         <esh-pager [model]="paginationInfo" (changed)="onPageChanged($event)"></esh-pager> | ||||||
|  |     </div> | ||||||
|  |     <div *ngIf="catalog?.data.length == 0"> | ||||||
|  |         <span>THERE ARE NO RESULTS THAT MATCH YOUR SEARCH</span> | ||||||
|  |     </div> | ||||||
| </div> | </div> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,21 +32,23 @@ | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     &-placeOrder { |     &-placeOrder { | ||||||
|         background-color: #83D01B; |         background-color: $color-secondary; | ||||||
|         border: 0; |         border: 0; | ||||||
|         border-radius: 0; |         border-radius: 0; | ||||||
|         color: #FFFFFF; |         color: $color-foreground-brighter; | ||||||
|         display: inline-block; |         display: inline-block; | ||||||
|         float: right; |         font-size: 1rem; | ||||||
|         font-size: 16px; |         font-weight: $font-weight-normal; | ||||||
|         font-weight: normal; |         margin-top: 1rem; | ||||||
|         height: 45px; |         padding: 1rem 1.5rem; | ||||||
|         margin-bottom: 40px; |  | ||||||
|         margin-top: 40px; |  | ||||||
|         padding: 10px 20px 10px 20px; |  | ||||||
|         text-align: center; |         text-align: center; | ||||||
|         text-transform: uppercase; |         text-transform: uppercase; | ||||||
|         width: 255px; |         transition: all $animation-speed-default; | ||||||
|  | 
 | ||||||
|  |         &:hover { | ||||||
|  |             background-color: $color-secondary-darker; | ||||||
|  |             transition: all $animation-speed-default; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     &-titles { |     &-titles { | ||||||
| @ -92,36 +94,3 @@ | |||||||
|         height: $item-height; |         height: $item-height; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| @media screen and (min-width: 992px) { |  | ||||||
|     .form-input { |  | ||||||
|         max-width: 360px; |  | ||||||
|         width: 360px; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input { |  | ||||||
|     border-radius: 0; |  | ||||||
|     height: 45px; |  | ||||||
|     padding: 10px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input-small { |  | ||||||
|     max-width: 100px !important; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input-medium { |  | ||||||
|     width: 150px !important; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .alert { |  | ||||||
|     padding-left: 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .alert-danger { |  | ||||||
|     background-color: transparent; |  | ||||||
|     border: 0; |  | ||||||
|     color: #FB0D0D; |  | ||||||
|     font-size: 12px; |  | ||||||
| } |  | ||||||
|  | |||||||