TourIAm/TIAM.Entities/Products/ProductBase.cs

50 lines
1.4 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AyCode.Interfaces.TimeStampInfo;
using Newtonsoft.Json;
using TIAM.Core.Enums;
using TIAM.Entities.Profiles;
namespace TIAM.Entities.Products;
public abstract class ProductBase : IProductBase, ITimeStampInfo
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
[Required]
public ProductType ProductType { get; set; }
//public Guid? UserMediaId { get; set; }
[Required]
public Guid ProfileId { get; set; }
[ForeignKey(nameof(ProfileId))]
public virtual Profile Profile { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public float Price { get; set; }
[NotMapped]
[JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string? JsonDetails { get; set; }
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
protected ProductBase(){}
protected ProductBase(Guid id, ProductType type, string name, string description, float price, string jsonDetails)
{
Id = id;
ProductType = type;
//UserMediaId = userMediaId;
Name = name;
Description = description;
Price = price;
JsonDetails = jsonDetails;
Created = DateTime.Now;
Modified = DateTime.Now;
}
}