My intern and I created my model in relation to other tables. Now I need to create the Dto. I'm not completely sure and I'm a little confused when creating relationship structures. I need to create the Dto of my model. How can I create it without error? Can you help me?
My Model: Activity.cs
[Table("Activity")]
public class Activity : FullAuditedEntity<int>
{
public int ScenarioId { get; set; }
public int BrandId { get; set; }
public int CategoryId { get; set; }
public int ProductId { get; set; }
public int ProductCodeId { get; set; }
public decimal DiscountedPrice { get; set; }
public decimal Discount { get; set; }
public decimal PromoMargin { get; set; }
[Description("Covid Connected Shutdown Status")]
public bool ShutdownStatus { get; set; }
[ForeignKey("BrandId")]
public virtual Brand Brand { get; set; }
[ForeignKey("CategoryId")]
public virtual Category Category { get; set; }
[ForeignKey("ProductId")]
public virtual Product Product { get; set; }
[ForeignKey("ProductCodeId")]
public virtual ProductCode ProductCode { get; set; }
[ForeignKey("ScenarioId")]
public virtual Scenario Scenario { get; set; }
I need to create ActivityDto.cs
[AutoMapFrom(typeof(Activity))]
public class ActivityDto : FullAuditedEntity<int>
{
[Required]
public decimal ActivityName { get; set; }
[Required]
public decimal DiscountedPrice { get; set; }
[Required]
public decimal Discount { get; set; }
[Required]
public decimal PromoMargin { get; set; }
[Required]
[Description("Covid Connected Shutdown Status")]
public bool ShutdownStatus { get; set; }
}
How can i create other relations dto too. Do I need to keep their Id in the form of a new list?