help
Root Question Message
[Table("ProductionOrder", Schema = "public")]
public class ProductionOrder
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Code { get; set; }
[ForeignKey("ProductId")]
public Product Product { get; set; }
public int ProductId { get; set; }
[ForeignKey("CustomerId")]
public Customer Customer { get; set; }
public int CustomerId { get; set; }
}
[Table("Product", Schema = "public")]
public class Product
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
}
[Table("Customer", Schema = "public")]
public class Customer
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
}
public async Task<List<ProductionOrder>> GetProductionOrdersAsync() {
return await _dbContext.ProductionOrder.ToListAsync();
}
List<ProductionOrder> orders = await _dbContext.ProductionOrder.Include(x => x.Product).Include(x => x.Customer).ToListAsync();