Browse Source

Minor changes in Catalog API

pull/49/merge
CESARDELATORRE 8 years ago
parent
commit
ebf181c595
4 changed files with 11 additions and 20 deletions
  1. +0
    -5
      src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs
  2. +0
    -8
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs
  3. +8
    -4
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  4. +3
    -3
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogItem.cs

+ 0
- 5
src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs View File

@ -20,7 +20,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
}
// GET api/v1/[controller]/items/[?pageSize=3&pageIndex=10]
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> Items(int pageSize = 10, int pageIndex = 0)
@ -41,7 +40,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
}
// GET api/v1/[controller]/items/withname/samplename
[HttpGet]
[Route("[action]/withname/{name:minlength(1)}")]
public async Task<IActionResult> Items(string name, int pageSize = 10, int pageIndex = 0)
@ -64,7 +62,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
}
// GET api/v1/[controller]/items/type/1/brand/null
[HttpGet]
[Route("[action]/type/{catalogTypeId}/brand/{catalogBrandId}")]
public async Task<IActionResult> Items(int? catalogTypeId, int? catalogBrandId, int pageSize = 10, int pageIndex = 0)
@ -96,7 +93,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
}
// GET api/v1/[controller]/CatalogTypes
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> CatalogTypes()
@ -108,7 +104,6 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
}
// GET api/v1/[controller]/CatalogBrands
[HttpGet]
[Route("[action]")]
public async Task<IActionResult> CatalogBrands()


+ 0
- 8
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs View File

@ -8,20 +8,14 @@
public CatalogContext(DbContextOptions options) : base(options)
{
}
public DbSet<CatalogItem> CatalogItems { get; set; }
public DbSet<CatalogBrand> CatalogBrands { get; set; }
public DbSet<CatalogType> CatalogTypes { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<CatalogBrand>(ConfigureCatalogBrand);
builder.Entity<CatalogType>(ConfigureCatalogType);
builder.Entity<CatalogItem>(ConfigureCatalogItem);
}
void ConfigureCatalogItem(EntityTypeBuilder<CatalogItem> builder)
@ -49,7 +43,6 @@
builder.HasOne(ci => ci.CatalogType)
.WithMany()
.HasForeignKey(ci => ci.CatalogTypeId);
}
void ConfigureCatalogBrand(EntityTypeBuilder<CatalogBrand> builder)
@ -69,7 +62,6 @@
void ConfigureCatalogType(EntityTypeBuilder<CatalogType> builder)
{
builder.ToTable("CatalogType");
builder.HasKey(ci => ci.Id);


+ 8
- 4
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -47,8 +47,10 @@
{
return new List<CatalogBrand>()
{
new CatalogBrand() { Brand="Azure"},
new CatalogBrand() { Brand = "Visual Studio" }
new CatalogBrand() { Brand = "Azure"},
new CatalogBrand() { Brand = ".NET" },
new CatalogBrand() { Brand = "Visual Studio" },
new CatalogBrand() { Brand = "SQL Server" }
};
}
@ -56,8 +58,10 @@
{
return new List<CatalogType>()
{
new CatalogType() { Type="Mug"},
new CatalogType() { Type = "T-Shirt" }
new CatalogType() { Type = "Mug"},
new CatalogType() { Type = "T-Shirt" },
new CatalogType() { Type = "Backpack" },
new CatalogType() { Type = "USB Memory Stick" }
};
}


+ 3
- 3
src/Services/Catalog/Catalog.API/Infrastructure/CatalogItem.cs View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
using System;
using System;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
{
public class CatalogItem
{
public int Id { get; set; }


Loading…
Cancel
Save