diff --git a/Mango.Nop.Core/Dtos/MgStockQuantityHistoryDto.cs b/Mango.Nop.Core/Dtos/MgStockQuantityHistoryDto.cs new file mode 100644 index 0000000..6d3cc1d --- /dev/null +++ b/Mango.Nop.Core/Dtos/MgStockQuantityHistoryDto.cs @@ -0,0 +1,70 @@ +using AyCode.Interfaces.Entities; +using LinqToDB.Mapping; +using Mango.Nop.Core.Entities; +using Mango.Nop.Core.Interfaces; +using Nop.Core.Domain.Catalog; +using Nop.Core.Domain.Common; +using Nop.Core.Domain.Orders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mango.Nop.Core.Dtos +{ + public interface IMgTStockQuantityHistoryDto : IEntityInt, IMgStockQuantityHistory where TProductDto : IMgProductDto + { + public TProductDto ProductDto { get; set; } + } + + public abstract class MgStockQuantityHistoryDto : MgEntityBase, IModelDtoBase, + IMgTStockQuantityHistoryDto where TProductDto : IMgProductDto + { + public int ProductId { get; set; } + public int QuantityAdjustment { get; set; } + + public int StockQuantity { get; set; } + + public string Message { get; set; } + + public int? CombinationId { get; set; } + + public int? WarehouseId { get; set; } + + public DateTime CreatedOnUtc { get; set; } + + [Association(ThisKey = nameof(ProductId), OtherKey = nameof(IMgProductDto.Id), CanBeNull = false)] + public TProductDto ProductDto { get; set; } + + public void CopyDtoValuesToEntity(Order entity) + { + throw new NotImplementedException(); + } + + public void CopyDtoValuesToEntity(StockQuantityHistory entity) + { + throw new NotImplementedException(); + } + + public void CopyEntityValuesToDto(Order entity) + { + throw new NotImplementedException(); + } + + public void CopyEntityValuesToDto(StockQuantityHistory entity) + { + throw new NotImplementedException(); + } + + public Order CreateMainEntity() + { + throw new NotImplementedException(); + } + + StockQuantityHistory IModelDtoBase.CreateMainEntity() + { + throw new NotImplementedException(); + } + } +} diff --git a/Mango.Nop.Core/NopDependencies/Catalogs/StockQuantityHistory.cs b/Mango.Nop.Core/NopDependencies/Catalogs/StockQuantityHistory.cs new file mode 100644 index 0000000..7b4890b --- /dev/null +++ b/Mango.Nop.Core/NopDependencies/Catalogs/StockQuantityHistory.cs @@ -0,0 +1,56 @@ +using AyCode.Interfaces.Entities; +using Mango.Nop.Core.Interfaces; + +namespace Nop.Core.Domain.Catalog; + +public interface IMgStockQuantityHistory +{ + public int ProductId { get; set; } + public int QuantityAdjustment { get; set; } + public int StockQuantity { get; set; } + public string Message { get; set; } + public int? CombinationId { get; set; } + public int? WarehouseId { get; set; } + public DateTime CreatedOnUtc { get; set; } +} + +/// +/// Represents a stock quantity change entry +/// +public partial class StockQuantityHistory : BaseEntity, IMgStockQuantityHistory +{ + /// + /// Gets or sets the stock quantity adjustment + /// + public int QuantityAdjustment { get; set; } + + /// + /// Gets or sets current stock quantity + /// + public int StockQuantity { get; set; } + + /// + /// Gets or sets the message + /// + public string Message { get; set; } + + /// + /// Gets or sets the date and time of instance creation + /// + public DateTime CreatedOnUtc { get; set; } + + /// + /// Gets or sets the product identifier + /// + public int ProductId { get; set; } + + /// + /// Gets or sets the product attribute combination identifier + /// + public int? CombinationId { get; set; } + + /// + /// Gets or sets the warehouse identifier + /// + public int? WarehouseId { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Data/Repositories/MgDtoDbTableBase.cs b/Mango.Nop.Data/Repositories/MgDtoDbTableBase.cs index a38ee2c..4902c01 100644 --- a/Mango.Nop.Data/Repositories/MgDtoDbTableBase.cs +++ b/Mango.Nop.Data/Repositories/MgDtoDbTableBase.cs @@ -21,7 +21,7 @@ public abstract class MgDtoDbTableBase : MgDbTableBase< public async Task GetMainEntityById(int id) => await _dataProvider.GetTable().FirstOrDefaultAsync(x => x.Id == id); - public async Task DeleteMainEntityById(int id, bool publishEvent = true) + public virtual async Task DeleteMainEntityById(int id, bool publishEvent = true) { var affectedRows = 0;