standarize the productId type
This commit is contained in:
parent
1671062715
commit
791e7d646c
@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models
|
|||||||
public class BasketDataItem
|
public class BasketDataItem
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
public decimal OldUnitPrice { get; set; }
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
@ -22,7 +22,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models
|
|||||||
public class BasketDataItem
|
public class BasketDataItem
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
public decimal OldUnitPrice { get; set; }
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
@ -25,7 +25,7 @@ message CustomerBasketResponse {
|
|||||||
|
|
||||||
message BasketItemResponse {
|
message BasketItemResponse {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string productid = 2;
|
int32 productid = 2;
|
||||||
string productname = 3;
|
string productname = 3;
|
||||||
double unitprice = 4;
|
double unitprice = 4;
|
||||||
double oldunitprice = 5;
|
double oldunitprice = 5;
|
||||||
|
@ -9,7 +9,7 @@ namespace eShopOnContainers.Core.Models.Basket
|
|||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ namespace eShopOnContainers.Core.Models.Orders
|
|||||||
{
|
{
|
||||||
public class OrderItem
|
public class OrderItem
|
||||||
{
|
{
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public Guid? OrderId { get; set; }
|
public Guid? OrderId { get; set; }
|
||||||
|
|
||||||
[JsonProperty("unitprice")]
|
[JsonProperty("unitprice")]
|
||||||
|
@ -39,8 +39,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
|
|||||||
|
|
||||||
private async Task UpdatePriceInBasketItems(int productId, decimal newPrice, decimal oldPrice, CustomerBasket basket)
|
private async Task UpdatePriceInBasketItems(int productId, decimal newPrice, decimal oldPrice, CustomerBasket basket)
|
||||||
{
|
{
|
||||||
string match = productId.ToString();
|
var itemsToUpdate = basket?.Items?.Where(x => x.ProductId == productId).ToList();
|
||||||
var itemsToUpdate = basket?.Items?.Where(x => x.ProductId == match).ToList();
|
|
||||||
|
|
||||||
if (itemsToUpdate != null)
|
if (itemsToUpdate != null)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Model
|
|||||||
public class BasketItem : IValidatableObject
|
public class BasketItem : IValidatableObject
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
public decimal OldUnitPrice { get; set; }
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
@ -25,7 +25,7 @@ message CustomerBasketResponse {
|
|||||||
|
|
||||||
message BasketItemResponse {
|
message BasketItemResponse {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string productid = 2;
|
int32 productid = 2;
|
||||||
string productname = 3;
|
string productname = 3;
|
||||||
double unitprice = 4;
|
double unitprice = 4;
|
||||||
double oldunitprice = 5;
|
double oldunitprice = 5;
|
||||||
|
@ -63,7 +63,7 @@ namespace Basket.FunctionalTests
|
|||||||
|
|
||||||
order.Items.Add(new BasketItem
|
order.Items.Add(new BasketItem
|
||||||
{
|
{
|
||||||
ProductId = "1",
|
ProductId = 1,
|
||||||
ProductName = ".NET Bot Black Hoodie",
|
ProductName = ".NET Bot Black Hoodie",
|
||||||
UnitPrice = 10,
|
UnitPrice = 10,
|
||||||
Quantity = 1
|
Quantity = 1
|
||||||
|
@ -75,7 +75,7 @@ namespace Basket.FunctionalTests
|
|||||||
{
|
{
|
||||||
Id = "basketId",
|
Id = "basketId",
|
||||||
PictureUrl = "pictureurl",
|
PictureUrl = "pictureurl",
|
||||||
ProductId = "productId",
|
ProductId = 1,
|
||||||
ProductName = "productName",
|
ProductName = "productName",
|
||||||
Quantity = 1,
|
Quantity = 1,
|
||||||
UnitPrice = 1
|
UnitPrice = 1
|
||||||
|
@ -8,7 +8,7 @@ namespace Ordering.API.Application.Models
|
|||||||
public class BasketItem
|
public class BasketItem
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public string ProductName { get; set; }
|
public string ProductName { get; set; }
|
||||||
public decimal UnitPrice { get; set; }
|
public decimal UnitPrice { get; set; }
|
||||||
public decimal OldUnitPrice { get; set; }
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
@ -21,7 +21,7 @@ namespace Ordering.API.Application.Models
|
|||||||
{
|
{
|
||||||
return new OrderItemDTO()
|
return new OrderItemDTO()
|
||||||
{
|
{
|
||||||
ProductId = int.TryParse(item.ProductId, out int id) ? id : -1,
|
ProductId = item.ProductId,
|
||||||
ProductName = item.ProductName,
|
ProductName = item.ProductName,
|
||||||
PictureUrl = item.PictureUrl,
|
PictureUrl = item.PictureUrl,
|
||||||
UnitPrice = item.UnitPrice,
|
UnitPrice = item.UnitPrice,
|
||||||
|
@ -16,7 +16,7 @@ message CreateOrderDraftCommand {
|
|||||||
|
|
||||||
message BasketItem {
|
message BasketItem {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string productId = 2;
|
int32 productId = 2;
|
||||||
string productName = 3;
|
string productName = 3;
|
||||||
double unitPrice = 4;
|
double unitPrice = 4;
|
||||||
double oldUnitPrice = 5;
|
double oldUnitPrice = 5;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface IBasketItem {
|
export interface IBasketItem {
|
||||||
id: string;
|
id: string;
|
||||||
productId: string;
|
productId: number;
|
||||||
productName: string;
|
productName: string;
|
||||||
unitPrice: number;
|
unitPrice: number;
|
||||||
oldUnitPrice: number;
|
oldUnitPrice: number;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface ICatalogItem {
|
export interface ICatalogItem {
|
||||||
id: string;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
price: number;
|
price: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user