public ListOfChairsViewModel(IChairDbContext chairDb, int basketCount) : base(ControllersEnum.Chairs, basketCount) { List <Chair> chairsNotOrder = chairDb.AllChairs(); this.Chairs = chairsNotOrder.OrderBy(x => x.NewPrice != null ? x.NewPrice : x.Price).ToList(); }
public ChairsController(IConfiguration config, IUtilities utilities, IUserDbContext userDb, IChairDbContext chairDb) : base(config, utilities, userDb) { this.config = config; this.utilities = utilities; this.userDb = userDb; this.chairDb = chairDb; }
public EditChairViewModel(ControllersEnum controller, int id, IChairDbContext chairDb) : base(controller) { this.Chair = chairDb.Edit(id); this.AdditionalImages = chairDb.AllAdditionalImagesByChairId(id); }
public EditChairViewModel(IChairDbContext chairDbContext, int id, int basketElementCount, int minAmoutToOrderChair) : base(ControllersEnum.Chairs, basketElementCount) { this.Chair = chairDbContext.Edit(id); this.MinAmoutToOrderChair = minAmoutToOrderChair; this.AdditionalChairImages = chairDbContext.AllAdditionalImagesByChairId(id); }
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 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 ChairsViewModel(IChairDbContext chairDb, ControllersEnum controllerEnum) : base(controllerEnum) { this.Chairs = chairDb.AllChairs(); }
public AdditionalImagesChairViewModel(int id, IChairDbContext chairDb) : base(ControllersEnum.Chairs) { this.ChairId = id; this.ChairsImages = chairDb.LoadAllAdditionalImagesChair(id); }