TourIAm/TIAM.Entities/Products/Product.cs

33 lines
1.6 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using TIAM.Core.Enums;
using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users;
namespace TIAM.Entities.Products;
[Table("Products")]
public class Product : ProductBase
{
[Required]
public Guid ServiceProviderId { get; set; }
public virtual Company ServiceProvider { get; set; }
public virtual List<User> Users { get; } = new();
public virtual List<UserProductMapping> UserProductMappings { get; } = new();
public Product(){}
public Product(Guid ownerId, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, productType, name, description, price, jsonDetails) { }
public Product(Guid id, Guid serviceProviderId, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
{
ServiceProviderId = serviceProviderId;
}
public Product(Guid ownerId, Company serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, serviceProvider, productType, name, description, price, jsonDetails) { }
public Product(Guid id, Guid serviceProviderId, Company serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
{
ServiceProviderId = serviceProviderId;
ServiceProvider = serviceProvider;
}
}