public AdditionalImagesCubeSeatViewModel(ICubeSeatDbContext db, int id)
            : base(ControllersEnum.CubeSeat)
        {
            this.CubeSeatAdditionalPhoto = db.LoadAllAdditionalImagesCubeSeat(id);

            this.CubeSeatId = id;
        }
Exemplo n.º 2
0
 public CubeSeatsAppController(IConfiguration config, IUtilities utilities, IUserDbContext userDb, ICubeSeatDbContext cubeSeatDb)
     : base(config, utilities, userDb)
 {
     this.config     = config;
     this.utilities  = utilities;
     this.userDb     = userDb;
     this.cubeSeatDb = cubeSeatDb;
 }
        public EditCubeSeatViewModel(ICubeSeatDbContext cubeSeatDb, int id, int basketCounts, int minAmountToOrderCubeSeat)
            : base(ControllersEnum.CubeSeats, basketCounts)
        {
            this.CubeSeat = cubeSeatDb.LoadCubeSeatById(id);

            this.MinAmountToOrderCubeSeat = minAmountToOrderCubeSeat;

            this.CubeSeatImages = cubeSeatDb.AllAdditionalImagesByCubeSeatId(id);
        }
Exemplo n.º 4
0
 public SearchController(IConfiguration config, IUtilities utilities, IUserDbContext userDb, IArmchairDbContext armchairDb,
                         IChairDbContext chairDb, ICubeSeatDbContext cubeSeatDb, ISofaDbContext sofaDb)
     : base(config, utilities, userDb)
 {
     this.config     = config;
     this.utilities  = utilities;
     this.userDb     = userDb;
     this.armchairDb = armchairDb;
     this.chairDb    = chairDb;
     this.cubeSeatDb = cubeSeatDb;
     this.sofaDb     = sofaDb;
 }
        public ListOfCubeSeats(ICubeSeatDbContext cubeSeatDb, int basketCount)
            : base(ControllersEnum.CubeSeats, basketCount)
        {
            List <CubeSeat> cubeSeatNotOrder = cubeSeatDb.AllCubeSeat();

            if (cubeSeatNotOrder != null)
            {
                this.CubeSeats = cubeSeatNotOrder.OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();
            }
            else
            {
                this.CubeSeats = new List <CubeSeat>();
            }
        }
Exemplo n.º 6
0
        public SearchViewModel(IArmchairDbContext armchairDb, IChairDbContext chairDb, ICubeSeatDbContext cubeSeatDb, ISofaDbContext sofaDb, string searchPattern, int basketCount, PriceSortBy?orderBy)
            : base(ControllersEnum.Search, basketCount)
        {
            if (!orderBy.HasValue)
            {
                this.Armchairs = armchairDb.AllArmchairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).ToList();

                this.CubeSeat = cubeSeatDb.AllCubeSeat().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).ToList();

                this.Sofas = sofaDb.AllSofas().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).ToList();

                this.Chairs = chairDb.AllChairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).ToList();
            }
            else
            {
                if (orderBy.Value == PriceSortBy.ASC)
                {
                    this.Armchairs = armchairDb.AllArmchairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.CubeSeat = cubeSeatDb.AllCubeSeat().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.Sofas = sofaDb.AllSofas().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.Chairs = chairDb.AllChairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();
                }
                else if (orderBy.Value == PriceSortBy.DESC)
                {
                    this.Armchairs = armchairDb.AllArmchairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderByDescending(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.CubeSeat = cubeSeatDb.AllCubeSeat().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderByDescending(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.Sofas = sofaDb.AllSofas().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderByDescending(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();

                    this.Chairs = chairDb.AllChairs().Where(x => x.Name.ToUpper().Contains(searchPattern.ToUpper())).OrderByDescending(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList();
                }
            }
        }
 public CubeSeatEditViewModel(ICubeSeatDbContext db, int id) : base(ControllersEnum.CubeSeat)
 {
     this.CubeSeat = db.LoadCubeSeatById(id);
 }
 public CubeSeatsViewModel(ICubeSeatDbContext db) : base(ControllersEnum.CubeSeat)
 {
     this.CubeSeat = db.AllCubeSeat();
 }