Esempio n. 1
0
 public Shelf GetSelectedShelf(int width, int depth, string type)
 {
     return(Shelves
            .Where(x => x.Width == width)
            .Where(x => x.Depth == depth)
            .Where(x => x.Type == type)
            .FirstOrDefault());
 }
Esempio n. 2
0
        private void ImportBooks()
        {
            var selected_shelves = Shelves.Where(s => s.Selected)
                                   .Select(s => s.Name)
                                   .ToList();
            var books_on_selected_shelves = Books.Where(b => !b.IsDuplicate && selected_shelves.Contains(b.ExclusiveShelf));
            var books_to_import           = GoodreadsMapper.Map(books_on_selected_shelves).ToList();

            import_controller.Import(books_to_import);

            MessageBus.Current.SendMessage(NavigationMessage.Books);
            MessageBus.Current.SendMessage(new InformationMessage($"{books_to_import.Count} books were imported"));
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
 public IQueryable <Shelf> GetAvailableShelves()
 {
     return(Shelves.Where(x => x.QuantityInStock > 0));
 }