Beispiel #1
0
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <MonitorAd> monitors = (IEnumerable <MonitorAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                monitors = IFilterAdsStrategy <MonitorAd> .FilterPrice(monitors, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                monitors = IFilterAdsStrategy <MonitorAd> .FilterBrand(monitors, select.Brand);
            }

            if (select.ScreenSize != 0)
            {
                monitors = monitors.Where(ad => ad.ScreenSize == select.ScreenSize);
            }
            if (select.Resolution?.Trim() != "" && select.Resolution != null)
            {
                monitors = monitors.Where(ad => ad.Resolution == select.MemoryType);
            }
            if (select.RefreshRate != 0)
            {
                monitors = monitors.Where(ad => ad.RefreshRate == select.RefreshRate);
            }

            return((IEnumerable <TEntity>)monitors);
        }
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <SmartphoneAd> smartphones = (IEnumerable <SmartphoneAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                smartphones = IFilterAdsStrategy <SmartphoneAd> .FilterPrice(smartphones, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                smartphones = IFilterAdsStrategy <SmartphoneAd> .FilterBrand(smartphones, select.Brand);
            }

            if (select.ScreenSize != 0)
            {
                smartphones = smartphones.Where(ad => ad.ScreenSize == select.ScreenSize);
            }
            if (select.RAM != 0)
            {
                smartphones = smartphones.Where(ad => ad.RAM == select.RAM);
            }
            if (select.BatteryCapacity != 0)
            {
                smartphones = smartphones.Where(ad => ad.BatteryCapacity == select.BatteryCapacity);
            }

            return((IEnumerable <TEntity>)smartphones);
        }
Beispiel #3
0
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <RAMAd> drives = (IEnumerable <RAMAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                drives = IFilterAdsStrategy <RAMAd> .FilterPrice(drives, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                drives = IFilterAdsStrategy <RAMAd> .FilterBrand(drives, select.Brand);
            }

            if (select.TotalCapacity != 0)
            {
                drives = drives.Where(ad => ad.TotalCapacity == select.TotalCapacity);
            }
            if (select.ModulesAmount != 0)
            {
                drives = drives.Where(ad => ad.ModulesAmount == select.ModulesAmount);
            }
            if (select.MemoryType?.Trim() != "" && select.MemoryType != null)
            {
                drives = drives.Where(ad => ad.MemoryType == select.MemoryType);
            }

            return((IEnumerable <TEntity>)drives);
        }
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <LaptopAd> laptops = (IEnumerable <LaptopAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                laptops = IFilterAdsStrategy <LaptopAd> .FilterPrice(laptops, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                laptops = IFilterAdsStrategy <LaptopAd> .FilterBrand(laptops, select.Brand);
            }

            if (select.ScreenSize != 0)
            {
                laptops = laptops.Where(ad => ad.ScreenSize == select.ScreenSize);
            }
            if (select.RAM != 0)
            {
                laptops = laptops.Where(ad => ad.RAM == select.RAM);
            }
            if (select.DriveVolume != 0)
            {
                laptops = laptops.Where(ad => ad.DriveVolume == select.BatteryCapacity);
            }

            return((IEnumerable <TEntity>)laptops);
        }
Beispiel #5
0
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <VideocardAd> videocards = (IEnumerable <VideocardAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                videocards = IFilterAdsStrategy <VideocardAd> .FilterPrice(videocards, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                videocards = IFilterAdsStrategy <VideocardAd> .FilterBrand(videocards, select.Brand);
            }

            if (select.MemorySize != 0)
            {
                videocards = videocards.Where(ad => ad.MemorySize == select.MemorySize);
            }
            if (select.MemoryType?.Trim() != "" && select.MemoryType != null)
            {
                videocards = videocards.Where(ad => ad.MemoryType == select.MemoryType);
            }

            return((IEnumerable <TEntity>)videocards);
        }
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <ProcessorAd> processors = (IEnumerable <ProcessorAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                processors = IFilterAdsStrategy <ProcessorAd> .FilterPrice(processors, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                processors = IFilterAdsStrategy <ProcessorAd> .FilterBrand(processors, select.Brand);
            }

            if (select.CoresAmount != 0)
            {
                processors = processors.Where(ad => ad.CoresAmount == select.CoresAmount);
            }
            if (select.ClockSpeed != 0)
            {
                processors = processors.Where(ad => ad.ClockSpeed == select.ClockSpeed);
            }

            return((IEnumerable <TEntity>)processors);
        }
        public IEnumerable <TEntity> Filter(IEnumerable <TEntity> ads, FilterVM select)
        {
            IEnumerable <DriveAd> drives = (IEnumerable <DriveAd>)ads;

            if (select.FromPrice != 0 || select.ToPrice != 0)
            {
                drives = IFilterAdsStrategy <DriveAd> .FilterPrice(drives, select.FromPrice, select.ToPrice);
            }
            if (select.Brand?.Trim() != "" && select.Brand != null)
            {
                drives = IFilterAdsStrategy <DriveAd> .FilterBrand(drives, select.Brand);
            }

            if (select.Capacity != 0)
            {
                drives = drives.Where(ad => ad.Capacity == select.Capacity);
            }
            if (select.RPM != 0)
            {
                drives = drives.Where(ad => ad.RPM == select.RPM);
            }

            return((IEnumerable <TEntity>)drives);
        }