jj that's basically what I was thinking of doing as well, it's definitely an improvement over what I posted.
Also like other ideas posted but seems slightly over complicated for this, but the lamdba/linq idea is a good one. You can reduce both functions to one liners like:
Code:
/// <summary>
/// Is a group in the basket already?
/// </summary>
public static bool isItemInBasket(List<BasketItem> BasketItems, int GroupID)
{
return (from c in BasketItems where c.GroupID == GroupID select c).SingleOrDefault() != null;
}
public static bool isItemInBasket(List<BasketItem> BasketItems, int GroupID, DateTime ArtworkDate)
{
return (from c in BasketItems where c.GroupID == GroupID && c.ArtworkDate == ArtworkDate select c).SingleOrDefault() != null;
}
I think that's probably best
Edit: This is ASP.net/C#