50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
|
|
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
|
|
|
public class ProductToAuctionDto : IProductToAuctionDto
|
|
{
|
|
public int Id { get; set; }
|
|
public int ProductId { get; set; }
|
|
public int AuctionId { get; set; }
|
|
public AuctionStatus AuctionStatus { get; set; }
|
|
public decimal StartingPrice { get; set; }
|
|
public decimal BidPrice { get; set; }
|
|
public int ProductAmount { get; set; }
|
|
public int SortIndex { get; set; }
|
|
|
|
public List<AuctionBidDto> AuctionBidDtos { get; } = [];
|
|
|
|
|
|
public ProductToAuctionDto()
|
|
{
|
|
}
|
|
|
|
public ProductToAuctionDto(ProductToAuctionMapping productToAuction)
|
|
{
|
|
Id = productToAuction.Id;
|
|
ProductId = productToAuction.ProductId;
|
|
AuctionId = productToAuction.AuctionId;
|
|
AuctionStatus = productToAuction.AuctionStatus;
|
|
StartingPrice = productToAuction.StartingPrice;
|
|
BidPrice = productToAuction.BidPrice;
|
|
ProductAmount = productToAuction.ProductAmount;
|
|
}
|
|
|
|
public ProductToAuctionMapping CreateMainEntity()
|
|
{
|
|
var mainEntity = Activator.CreateInstance<ProductToAuctionMapping>();
|
|
|
|
mainEntity.Id = Id;
|
|
mainEntity.ProductId = ProductId;
|
|
mainEntity.AuctionId = AuctionId;
|
|
mainEntity.AuctionStatus = AuctionStatus;
|
|
mainEntity.StartingPrice = StartingPrice;
|
|
mainEntity.BidPrice = BidPrice;
|
|
mainEntity.ProductAmount = ProductAmount;
|
|
|
|
return mainEntity;
|
|
}
|
|
} |