public class Product : BaseModel
{
[Key]
public int ProductID { get; set; }
[Required]
//[DisplayName("Group")]
[LocalizedDisplayName("FIRST_NAME", NameResourceType = typeof(Strings))]
public int ProductGroupID { get; set; }
[Required]
[DisplayName("Product")]
public int ProductNameID { get; set; }
[DisplayName("Type")]
public int? ProductTypeID { get; set; }
[Required]
[StringLength(100)]
[DisplayName("Other Name")]
public string Name { get; set; }
[Required]
[StringLength(100)]
[DisplayName("Brand")]
public string BrandName { get; set; }
[Required]
[StringLength(100)]
[DisplayName("Quality")]
public string Quality { get; set; }
[Required]
[StringLength(100)]
[DisplayName("Size - Colli")]
public string ColliSize { get; set; }
[Required]
[StringLength(100)]
[DisplayName("Colli Dimensions")]
public string ColliDimensions { get; set; }
[ScriptIgnore]
public virtual ProductGroup ProductGroup { get; set; }
[ScriptIgnore]
public virtual ProductName ProductName { get; set; }
[ScriptIgnore]
public virtual ProductType ProductType { get; set; }
[ScriptIgnore]
public virtual ColliType ColliType { get; set; }
[ScriptIgnore]
public virtual Country Country { get; set; }
[ScriptIgnore]
public virtual Currency Currency { get; set; }
[ScriptIgnore]
public virtual ICollection<PreferredLocation> PreferredLocations { get; set; }
[ScriptIgnore]
public virtual ICollection<Order> Orders { get; set; }
}
}
public class ProductName : BaseModel
{
[Key]
public int ProductNameID { get; set; }
[DisplayName("Product")]
[StringLength(50)]
public string Name { get; set; }
[Required]
public int ProductGroupID { get; set; }
[ScriptIgnore]
public virtual ProductGroup ProductGroup { get; set; }
[ScriptIgnore]
public virtual ICollection<Product> Products { get; set; }
[ScriptIgnore]
public virtual ICollection<ProductType> ProductTypes { get; set; }
}
public class Order : BaseModel
{
[Key]
public int OrderID { get; set; }
[Required]
[DisplayName("Colli Count")]
public int ColliCount { get; set; }
[Required]
[DisplayName("Order Available?")]
public bool OrderAvailable { get; set; }
[Required]
[DisplayName("Order Shipped")]
public bool OrderShipped { get; set; }
[Required]
[DisplayName("Order Completed")]
public bool OrderCompleted { get; set; }
[DisplayName("Order Cancelled")]
public bool OrderCancelled { get; set; }
[Required]
[ForeignKey("Buyer")]
public int BuyerID { get; set; }
[Required]
[ForeignKey("Seller")]
public int SellerID { get; set; }
[Required]
public int ProductID { get; set; }
//public int OfferID { get; set; }
[Required]
public int PreferredLocationID { get; set; }
public float? Latitude { get; set; }
public float? Longitude { get; set; }
[ScriptIgnore]
public virtual User Buyer { get; set; }
[ScriptIgnore]
public virtual User Seller { get; set; }
[ScriptIgnore]
public virtual Product Product { get; set; }
public virtual PreferredLocation PreferredLocation { get; set; }
}
These are three model classes,
I need to retrieve no.of orders for each product.
Srujana, if this helps please login to Mark As Answer. | Alert Moderator