improvements, fixes, etc...

This commit is contained in:
Loretta 2025-09-30 18:18:22 +02:00
parent 19cc506fc2
commit 96eb509ec5
3 changed files with 52 additions and 5 deletions

View File

@ -12,7 +12,11 @@ public interface IModelDtoBase : IEntityInt, IModelDtoBaseEmpty
{
}
public interface IModelDtoBase<out TMainEntity> : IModelDtoBase where TMainEntity : BaseEntity
public interface IModelDtoBase<TMainEntity> : IModelDtoBase where TMainEntity : BaseEntity
{
TMainEntity CreateMainEntity();
void CopyDtoValuesToEntity(TMainEntity entity);
void CopyEntityValuesToDto(TMainEntity entity);
}

View File

@ -1,10 +1,13 @@
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using AyCode.Interfaces.Entities;
using Mango.Nop.Core.Interfaces;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Discounts;
namespace Mango.Nop.Core.Dtos;
public class ProductDto : ModelDtoBase<Product>, ISoftDeletedEntity
public class ProductDto : ModelDtoBase<Product>, IProductDto//, IDiscountSupported<DiscountProductMapping>
{
//public int Id { get; set; }
public int ProductTypeId { get; set; }
public int ParentGroupedProductId { get; set; }
@ -24,7 +27,7 @@ public class ProductDto : ModelDtoBase<Product>, ISoftDeletedEntity
public ProductDto() :base()
{ }
public ProductDto(int product) : base(product)
public ProductDto(int productId) : base(productId)
{ }
public ProductDto(Product product) : base(product)
{ }
@ -72,4 +75,17 @@ public class ProductDto : ModelDtoBase<Product>, ISoftDeletedEntity
Deleted = entity.Deleted;
}
public override Product CreateMainEntity()
{
//base.CreateMainEntity();
var product = new Product();
CopyDtoValuesToEntity(product);
return product;
}
public bool SubjectToAcl { get; set; }
public bool LimitedToStores { get; set; }
}

View File

@ -0,0 +1,27 @@
using AyCode.Interfaces.Entities;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Discounts;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Security;
using Nop.Core.Domain.Seo;
using Nop.Core.Domain.Stores;
namespace Mango.Nop.Core.Interfaces;
public interface IProductDto : IEntityInt, ILocalizedEntity, ISlugSupported, IAclSupported, IStoreMappingSupported/*, IDiscountSupported<DiscountProductMapping>*/, ISoftDeletedEntity
{
int ProductTypeId { get; set; }
int ParentGroupedProductId { get; set; }
string Name { get; set; }
string ShortDescription { get; set; }
string FullDescription { get; set; }
int WarehouseId { get; set; }
int StockQuantity { get; set; }
decimal Weight { get; set; }
decimal Length { get; set; }
decimal Width { get; set; }
decimal Height { get; set; }
}