- Consuming Ordering.API microservice from WebMVC app
- SQL DB updated with EF Migrations - build-images.ps1 updated
This commit is contained in:
parent
2e43db4953
commit
67e94c3c45
@ -15,6 +15,7 @@ Write-Host "webPathToPub is $webPathToPub" -ForegroundColor Yellow
|
|||||||
|
|
||||||
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
||||||
dotnet restore $webPathToJson
|
dotnet restore $webPathToJson
|
||||||
|
dotnet build $webPathToJson
|
||||||
dotnet publish $webPathToJson -o $webPathToPub
|
dotnet publish $webPathToJson -o $webPathToPub
|
||||||
|
|
||||||
#*** Catalog service image ***
|
#*** Catalog service image ***
|
||||||
@ -25,6 +26,7 @@ Write-Host "catalogPathToPub is $catalogPathToPub" -ForegroundColor Yellow
|
|||||||
|
|
||||||
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
||||||
dotnet restore $catalogPathToJson
|
dotnet restore $catalogPathToJson
|
||||||
|
dotnet build $catalogPathToJson
|
||||||
dotnet publish $catalogPathToJson -o $catalogPathToPub
|
dotnet publish $catalogPathToJson -o $catalogPathToPub
|
||||||
|
|
||||||
#*** Ordering service image ***
|
#*** Ordering service image ***
|
||||||
@ -35,6 +37,7 @@ Write-Host "orderingPathToPub is $orderingPathToPub" -ForegroundColor Yellow
|
|||||||
|
|
||||||
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
|
||||||
dotnet restore $orderingPathToJson
|
dotnet restore $orderingPathToJson
|
||||||
|
dotnet build $orderingPathToJson
|
||||||
dotnet publish $orderingPathToJson -o $orderingPathToPub
|
dotnet publish $orderingPathToJson -o $orderingPathToPub
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,16 +2,17 @@ version: '2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
webmvc:
|
webmvc:
|
||||||
image: eshop/web
|
image: eshop/web:latest
|
||||||
environment:
|
environment:
|
||||||
- CatalogUrl=http://catalog.api
|
- CatalogUrl=http://catalog.api
|
||||||
|
- OrderingUrl=http://ordering.api
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- catalog.api
|
- catalog.api
|
||||||
|
|
||||||
catalog.api:
|
catalog.api:
|
||||||
image: eshop/catalog.api
|
image: eshop/catalog.api:latest
|
||||||
environment:
|
environment:
|
||||||
- ConnectionString=Server=catalogdata;Port=5432;Database=postgres;username=postgres
|
- ConnectionString=Server=catalogdata;Port=5432;Database=postgres;username=postgres
|
||||||
expose:
|
expose:
|
||||||
@ -23,11 +24,16 @@ services:
|
|||||||
image: glennc/eshopdata
|
image: glennc/eshopdata
|
||||||
|
|
||||||
ordering.api:
|
ordering.api:
|
||||||
image: eshop/ordering.api
|
image: eshop/ordering.api:latest
|
||||||
environment:
|
environment:
|
||||||
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
ports:
|
ports:
|
||||||
- "81:80"
|
- "81:80"
|
||||||
|
# (Go to Production): For secured/final deployment, remove Ports mapping and
|
||||||
|
# leave just the internal expose section
|
||||||
|
# expose:
|
||||||
|
# - "80"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "CESARDLBOOKVHD:10.0.75.1"
|
- "CESARDLBOOKVHD:10.0.75.1"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
123
src/Services/Ordering/Ordering.API/Migrations/20161011040943_Migration2.Designer.cs
generated
Normal file
123
src/Services/Ordering/Ordering.API/Migrations/20161011040943_Migration2.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork;
|
||||||
|
|
||||||
|
namespace Ordering.API.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OrderingDbContext))]
|
||||||
|
[Migration("20161011040943_Migration2")]
|
||||||
|
partial class Migration2
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
|
||||||
|
.HasAnnotation("Relational:Sequence:shared.OrderSequences", "'OrderSequences', 'shared', '1001', '1', '', '', 'Int32', 'False'")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("City");
|
||||||
|
|
||||||
|
b.Property<string>("Country");
|
||||||
|
|
||||||
|
b.Property<string>("CountryCode");
|
||||||
|
|
||||||
|
b.Property<double>("Latitude");
|
||||||
|
|
||||||
|
b.Property<double>("Longitude");
|
||||||
|
|
||||||
|
b.Property<string>("State");
|
||||||
|
|
||||||
|
b.Property<string>("StateCode");
|
||||||
|
|
||||||
|
b.Property<string>("Street");
|
||||||
|
|
||||||
|
b.Property<string>("ZipCode");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Address");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<Guid?>("BillingAddressId");
|
||||||
|
|
||||||
|
b.Property<Guid>("BuyerId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("OrderDate");
|
||||||
|
|
||||||
|
b.Property<int>("SequenceNumber")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasDefaultValueSql("NEXT VALUE FOR shared.OrderSequences");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ShippingAddressId");
|
||||||
|
|
||||||
|
b.Property<int>("Status");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BillingAddressId");
|
||||||
|
|
||||||
|
b.HasIndex("ShippingAddressId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<decimal>("Discount");
|
||||||
|
|
||||||
|
b.Property<int>("FulfillmentRemaining");
|
||||||
|
|
||||||
|
b.Property<Guid>("OrderId");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProductId");
|
||||||
|
|
||||||
|
b.Property<string>("ProductName");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity");
|
||||||
|
|
||||||
|
b.Property<decimal>("UnitPrice");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("OrderItem");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", "BillingAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BillingAddressId");
|
||||||
|
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", "ShippingAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ShippingAddressId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Ordering.API.Migrations
|
||||||
|
{
|
||||||
|
public partial class Migration2 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ProductName",
|
||||||
|
table: "OrderItem",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ProductName",
|
||||||
|
table: "OrderItem");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
src/Services/Ordering/Ordering.API/Migrations/20161011041130_Migration3.Designer.cs
generated
Normal file
123
src/Services/Ordering/Ordering.API/Migrations/20161011041130_Migration3.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork;
|
||||||
|
|
||||||
|
namespace Ordering.API.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OrderingDbContext))]
|
||||||
|
[Migration("20161011041130_Migration3")]
|
||||||
|
partial class Migration3
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431")
|
||||||
|
.HasAnnotation("Relational:Sequence:shared.OrderSequences", "'OrderSequences', 'shared', '1001', '1', '', '', 'Int32', 'False'")
|
||||||
|
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("City");
|
||||||
|
|
||||||
|
b.Property<string>("Country");
|
||||||
|
|
||||||
|
b.Property<string>("CountryCode");
|
||||||
|
|
||||||
|
b.Property<double>("Latitude");
|
||||||
|
|
||||||
|
b.Property<double>("Longitude");
|
||||||
|
|
||||||
|
b.Property<string>("State");
|
||||||
|
|
||||||
|
b.Property<string>("StateCode");
|
||||||
|
|
||||||
|
b.Property<string>("Street");
|
||||||
|
|
||||||
|
b.Property<string>("ZipCode");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Address");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<Guid?>("BillingAddressId");
|
||||||
|
|
||||||
|
b.Property<Guid>("BuyerId");
|
||||||
|
|
||||||
|
b.Property<DateTime>("OrderDate");
|
||||||
|
|
||||||
|
b.Property<int>("SequenceNumber")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasDefaultValueSql("NEXT VALUE FOR shared.OrderSequences");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ShippingAddressId");
|
||||||
|
|
||||||
|
b.Property<int>("Status");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BillingAddressId");
|
||||||
|
|
||||||
|
b.HasIndex("ShippingAddressId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<decimal>("Discount");
|
||||||
|
|
||||||
|
b.Property<int>("FulfillmentRemaining");
|
||||||
|
|
||||||
|
b.Property<Guid>("OrderId");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProductId");
|
||||||
|
|
||||||
|
b.Property<string>("ProductName");
|
||||||
|
|
||||||
|
b.Property<int>("Quantity");
|
||||||
|
|
||||||
|
b.Property<decimal>("UnitPrice");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("OrderItem");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", "BillingAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("BillingAddressId");
|
||||||
|
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Address", "ShippingAddress")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ShippingAddressId");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.Order")
|
||||||
|
.WithMany("OrderItems")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Ordering.API.Migrations
|
||||||
|
{
|
||||||
|
public partial class Migration3 : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -86,6 +86,8 @@ namespace Ordering.API.Migrations
|
|||||||
|
|
||||||
b.Property<Guid>("ProductId");
|
b.Property<Guid>("ProductId");
|
||||||
|
|
||||||
|
b.Property<string>("ProductName");
|
||||||
|
|
||||||
b.Property<int>("Quantity");
|
b.Property<int>("Quantity");
|
||||||
|
|
||||||
b.Property<decimal>("UnitPrice");
|
b.Property<decimal>("UnitPrice");
|
||||||
|
@ -50,6 +50,9 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
|
|||||||
|
|
||||||
var connString = Configuration["ConnectionString"];
|
var connString = Configuration["ConnectionString"];
|
||||||
|
|
||||||
|
//(CDLTLL) To use only for EF Migrations
|
||||||
|
//connString = @"Server=10.0.75.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;";
|
||||||
|
|
||||||
services.AddDbContext<OrderingDbContext>(options => options.UseSqlServer(connString)
|
services.AddDbContext<OrderingDbContext>(options => options.UseSqlServer(connString)
|
||||||
.UseSqlServer(connString, b => b.MigrationsAssembly("Ordering.API"))
|
.UseSqlServer(connString, b => b.MigrationsAssembly("Ordering.API"))
|
||||||
//(CDLTLL) MigrationsAssembly will be Ordering.SqlData, but when supported
|
//(CDLTLL) MigrationsAssembly will be Ordering.SqlData, but when supported
|
||||||
|
@ -10,6 +10,10 @@ services:
|
|||||||
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
||||||
ports:
|
ports:
|
||||||
- "81:80"
|
- "81:80"
|
||||||
|
# (Go to Production): For secured/final deployment, remove Ports mapping and
|
||||||
|
# leave just the internal expose section
|
||||||
|
# expose:
|
||||||
|
# - "80"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "CESARDLBOOKVHD:10.0.75.1"
|
- "CESARDLBOOKVHD:10.0.75.1"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
3
src/Services/Ordering/Ordering.API/settings.json
Normal file
3
src/Services/Ordering/Ordering.API/settings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"ConnectionString": "Server=127.0.0.1;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;"
|
||||||
|
}
|
@ -17,6 +17,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel
|
|||||||
|
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public decimal Discount { get; set; }
|
public decimal Discount { get; set; }
|
||||||
|
@ -16,7 +16,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
|
|||||||
|
|
||||||
public DbSet<Order> Orders { get; set; }
|
public DbSet<Order> Orders { get; set; }
|
||||||
|
|
||||||
//(CDLTLL) Probably delete, not using it for now
|
//(CDLTLL)
|
||||||
/*
|
/*
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork
|
|||||||
optionsBuilder.UseSqlServer(connString);
|
optionsBuilder.UseSqlServer(connString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:2113/",
|
|
||||||
"sslPort": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,6 +9,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
{
|
{
|
||||||
public Connectionstrings ConnectionStrings { get; set; }
|
public Connectionstrings ConnectionStrings { get; set; }
|
||||||
public string CatalogUrl { get; set; }
|
public string CatalogUrl { get; set; }
|
||||||
|
public string OrderingUrl { get; set; }
|
||||||
public Logging Logging { get; set; }
|
public Logging Logging { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,16 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
@ -4,5 +4,4 @@ ARG source=.
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV ASPNETCORE_URLS http://*:80
|
ENV ASPNETCORE_URLS http://*:80
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
COPY $source .
|
COPY $source .
|
||||||
|
|
21
src/Web/WebMVC/Models/Address.cs
Normal file
21
src/Web/WebMVC/Models/Address.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
{
|
||||||
|
public class Address
|
||||||
|
{
|
||||||
|
public Guid ID { get; set; }
|
||||||
|
public string Street { get; set; }
|
||||||
|
public string City { get; set; }
|
||||||
|
public string State { get; set; }
|
||||||
|
public string StateCode { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public string CountryCode { get; set; }
|
||||||
|
public string ZipCode { get; set; }
|
||||||
|
public double Latitude { get; set; }
|
||||||
|
public double Longitude { get; set; }
|
||||||
|
}
|
||||||
|
}
|
29
src/Web/WebMVC/Models/Order.cs
Normal file
29
src/Web/WebMVC/Models/Order.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
{
|
||||||
|
public class Order
|
||||||
|
{
|
||||||
|
Guid Id;
|
||||||
|
public List<OrderItem> OrderItems { get; set; }
|
||||||
|
public string OrderNumber
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return string.Format("{0}/{1}-{2}", OrderDate.Year, OrderDate.Month, SequenceNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int SequenceNumber { get; set; }
|
||||||
|
public virtual Guid BuyerId { get; set; }
|
||||||
|
public virtual Address ShippingAddress { get; set; }
|
||||||
|
public virtual Address BillingAddress { get; set; }
|
||||||
|
public virtual DateTime OrderDate { get; set; }
|
||||||
|
|
||||||
|
//(CDLTLL) public virtual OrderStatus Status { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
23
src/Web/WebMVC/Models/OrderItem.cs
Normal file
23
src/Web/WebMVC/Models/OrderItem.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
{
|
||||||
|
public class OrderItem
|
||||||
|
{
|
||||||
|
Guid Id;
|
||||||
|
public Guid ProductId { get; set; }
|
||||||
|
public Guid OrderId { get; set; }
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
public decimal UnitPrice { get; set; }
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
public decimal Discount { get; set; }
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Format("Product Id: {0}, Quantity: {1}", this.Id, this.Quantity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
src/Web/WebMVC/Views/Home/Orders.cshtml
Normal file
50
src/Web/WebMVC/Views/Home/Orders.cshtml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
@{
|
||||||
|
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>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
|||||||
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||||
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Orders">Orders</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@await Html.PartialAsync("_LoginPartial")
|
@await Html.PartialAsync("_LoginPartial")
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"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"
|
||||||
},
|
},
|
||||||
"CatalogUrl": "http://localhost:2418/",
|
"CatalogUrl": "http://localhost:2418/",
|
||||||
|
"OrderingUrl": "http://localhost:2446/",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
@ -8,6 +8,7 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
environment:
|
environment:
|
||||||
- CatalogUrl=http://catalog.api
|
- CatalogUrl=http://catalog.api
|
||||||
|
- OrderingUrl=http://ordering.api
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -31,6 +32,10 @@ services:
|
|||||||
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
- ConnectionString=Server=ordering.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
|
||||||
ports:
|
ports:
|
||||||
- "81:80"
|
- "81:80"
|
||||||
|
# (Go to Production): For secured/final deployment, remove Ports mapping and
|
||||||
|
# leave just the internal expose section
|
||||||
|
# expose:
|
||||||
|
# - "80"
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "CESARDLBOOKVHD:10.0.75.1"
|
- "CESARDLBOOKVHD:10.0.75.1"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user