I have 2 classes like this:
public partial class Product
{
public ICollection<ProductTerm> ProductTerms { get; set; }
// More properties here
}
public partial class ProductTerm
{
public short ID { get; set; }
public short MinTermDuration { get; set; }
// More properties here
}
As you will see, Product has a 1 to many relationship with ProductTerm.
I'm trying to return the entire ProductTerm with the Min MinTermDuration. I can get the result I want here but am returning the MinTermDuration - how do I return the whole ProductTerm?
int GetMinTerm()
{
return ProductTerms.Min(t => t.MinTermDuration);
}