예제 #1
0
        public static List <Part> GetPartsWithoutSpoilages()
        {
            var paRep = new PartRepository();
            var parts = paRep.All().ToList();

            return(parts.Where(p => p.Spoilages.Count < 1).ToList());
        }
예제 #2
0
        public static Part GetHighestValue()
        {
            //Static method that returns the Part with the highest current inventory value as a public static method.
            var paRep = new PartRepository();
            var parts = paRep.All().ToList();

            return(parts.OrderByDescending(p => p.CurrentValue).FirstOrDefault());
        }
예제 #3
0
        public static Dictionary <int, Part> GetPartDictionary()
        {
            //Static method that returns the Part with the highest current inventory value as a public static method.
            var paRep = new PartRepository();
            var parts = paRep.All().ToList();

            //return (from part in parts group part by part.PartId into pg select pg).ToDictionary();
            return(parts.ToDictionary(p => p.PartId));
        }