I am trying to use Linq to search for a certain Product. How would I conduct this?
public class ShoppingCart : List<CartLine>
{
// implement constructors you want available
public ShoppingCart(){}
public ShoppingCart( IEnumerable<CartLine> collection ) : base( collection ) {}
public ShoppingCart( int capacity ) : base( capacity ) {}
}
public class CartLine
{
public int CartLineId { get; set; }
public Product Product { get; set; }
public int Quantity { get; set; }
}
public class Product
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public string ImageLocation { get; set; }
public int? ProductCategoryId { get; set; }
public virtual ProductCategory ProductCategory { get; set; }
}
ShoppingCart shoppingCart = new ShoppingCart();
Linq Query Search: This keeps giving me errors, trying to use Resharper to get this in my repository pattern, testing
shoppingCart.Find(p=>p.CartLine.Product.ProductName) = "SamsungTV"