67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using LittleShop.Enums;
|
|
|
|
namespace LittleShop.DTOs;
|
|
|
|
public class ProductDto
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public ProductWeightUnit ProductWeightUnit { get; set; }
|
|
public double ProductWeight { get; set; }
|
|
public decimal BasePrice { get; set; }
|
|
public Guid CategoryId { get; set; }
|
|
public string CategoryName { get; set; } = string.Empty;
|
|
public DateTime CreatedAt { get; set; }
|
|
public bool IsActive { get; set; }
|
|
public List<ProductPhotoDto> Photos { get; set; } = new();
|
|
}
|
|
|
|
public class ProductPhotoDto
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string FileName { get; set; } = string.Empty;
|
|
public string FilePath { get; set; } = string.Empty;
|
|
public string? AltText { get; set; }
|
|
public int SortOrder { get; set; }
|
|
}
|
|
|
|
public class CreateProductDto
|
|
{
|
|
[Required]
|
|
[StringLength(200)]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
public ProductWeightUnit ProductWeightUnit { get; set; }
|
|
|
|
public double ProductWeight { get; set; }
|
|
|
|
[Range(0.01, double.MaxValue)]
|
|
public decimal BasePrice { get; set; }
|
|
|
|
[Required]
|
|
public Guid CategoryId { get; set; }
|
|
}
|
|
|
|
public class UpdateProductDto
|
|
{
|
|
[StringLength(200)]
|
|
public string? Name { get; set; }
|
|
|
|
public string? Description { get; set; }
|
|
|
|
public ProductWeightUnit? ProductWeightUnit { get; set; }
|
|
|
|
public double? ProductWeight { get; set; }
|
|
|
|
[Range(0.01, double.MaxValue)]
|
|
public decimal? BasePrice { get; set; }
|
|
|
|
public Guid? CategoryId { get; set; }
|
|
|
|
public bool? IsActive { get; set; }
|
|
} |