public static async Task <List <int> > GetItemSetByLabIDAsync(int labID) { List <ItemDetail> itemDetails = await ItemDB.GetAllDetailByLabIDAsync(labID); List <int> itemSet = new List <int>(); itemDetails.ForEach(item => { if (!itemSet.Contains(item.type)) { itemSet.Add(item.type); } }); return(itemSet); }
public static async Task <List <int> > GetAllQuantityByLabIDAsync(int labID) { List <ItemDetail> itemDetails = await ItemDB.GetAllDetailByLabIDAsync(labID); List <int> itemSet = new List <int>(); List <int> itemQuantity = new List <int>(); itemDetails.ForEach(item => { if (!itemSet.Contains(item.type)) { itemSet.Add(item.type); itemQuantity.Add(0); } int index = itemSet.IndexOf(item.type); itemQuantity[index]++; }); return(itemQuantity); }