Beispiel #1
0
 public Balcony GetSelectedBalcony(int width, int height)
 {
     return(Balconies
            .Where(x => x.Width == width)
            .Where(x => x.Height == height)
            .FirstOrDefault());
 }
Beispiel #2
0
        public decimal CalculateValue(Fridge fridge)
        {
            decimal value = Compressors.Where(x => x.Symbol == fridge.CompressorSymbol).SingleOrDefault().Price +
                            Bodies.Where(x => x.Symbol == fridge.BodySymbol).SingleOrDefault().Price;

            if (fridge.ShelfSet != null && fridge.ShelfSet.Count > 0)
            {
                foreach (var shelfSet in fridge.ShelfSet)
                {
                    value += Shelves.Where(x => x.Symbol == shelfSet.ShelfSymbol)
                             .SingleOrDefault().Price *shelfSet.Quantity;
                }
            }
            if (fridge.HandleSet != null && fridge.HandleSet.Count > 0)
            {
                foreach (var handleSet in fridge.HandleSet)
                {
                    value += Handles.Where(x => x.Symbol == handleSet.HandleSymbol)
                             .SingleOrDefault().Price *handleSet.Quantity;
                }
            }
            if (fridge.BalconySet != null && fridge.BalconySet.Count > 0)
            {
                foreach (var balconySet in fridge.BalconySet)
                {
                    value += Balconies.Where(x => x.Symbol == balconySet.BalconySymbol)
                             .SingleOrDefault().Price *balconySet.Quantity;
                }
            }
            if (fridge.AdditionalSet != null && fridge.AdditionalSet.Count > 0)
            {
                foreach (var additionalSet in fridge.AdditionalSet)
                {
                    value += Additionals.Where(x => x.Symbol == additionalSet.AdditionalEqSymbol)
                             .SingleOrDefault().Price;
                }
            }
            return(value * 1.25M);
        }
Beispiel #3
0
 public IQueryable <Balcony> GetAvailableBalconies()
 {
     return(Balconies.Where(x => x.QuantityInStock > 0));
 }