Beispiel #1
0
        public List <Item> GetItems(string serialNumber, string productName, int barcode)
        {
            using (var db = new DatabaseContext())
            {
                List <Item> items = _itemDa.GetItems(db, serialNumber, productName, barcode);
                foreach (Item item in items)
                {
                    item.Price = CalculateIncomingPrice(db, item);
                }
                items = items.GroupBy(x =>
                                      new
                {
                    x.SerNumber,
                    x.Price,
                    x.Product_ID
                })
                        .Select(g => new
                {
                    item  = g.Select(c => c).FirstOrDefault(),
                    count = g.Count()
                })
                        .Select(x => { x.item.Quantity = x.count; return(x.item); })
                        .ToList();

                return(items);
            }
        }
Beispiel #2
0
 public List <Item> GetItems(string serialNumber, string productName, int barcode, bool showAll)
 {
     using (var db = new DatabaseContext())
     {
         return(_itemDa.GetItems(db, serialNumber, productName, barcode, showAll));
     }
 }