public IEnumerable <Auction> SelectAuctionsList() { IEnumerable <Auction> list = AuctionRepo.GetAuctions(); list = list.Where(p => p.status == "otwarte"); //catgory filtering if ((int)View.FilterCategory > 0) { list = list.Where(p => p.Category == (int)View.FilterCategory); } // ((Aukcje.Site)this.Page.Master).changeValueInDropDowCategoryList((int)category); if (!String.IsNullOrEmpty(View.SearchedItem)) { list = list.Where(p => (p.Title.IndexOf(View.SearchedItem, StringComparison.OrdinalIgnoreCase) >= 0)); // ((Aukcje.Site)this.Page.Master).changeValueInTextSearchBar(SearchedItem); } list = list.Where(p => p.Price >= View.FilterLowPrice && p.Price <= View.FilterHighPrice); //color filtering List <Auction> tempList = new List <Auction>(); if (View.FilterColorCheckBoxList.SelectedIndex > -1) { foreach (ListItem listItem in View.FilterColorCheckBoxList.Items) { if (listItem.Selected) { tempList.AddRange(list.Where(p => p.Color == Convert.ToInt32(listItem.Value)).ToList()); } } list = tempList; } //brand filtering tempList = new List <Auction>(); if (View.FilterBrandsCheckBoxList.SelectedIndex > -1) { foreach (ListItem listItem in View.FilterBrandsCheckBoxList.Items) { if (listItem.Selected) { tempList.AddRange(list.Where(p => p.Brand == Convert.ToString(listItem.Text)).ToList()); } } list = tempList; } foreach (Auction auction in list) { auction.Price = CurrencyConverter.ConvertMoney(auction.Price); } return(list); }
public IEnumerable <Aukcje.Auction> SelectItems() { IEnumerable <Auction> list = AuctionRepo.GetAuctionById(Convert.ToInt32(HttpContext.Current.Request.QueryString["ID"])); foreach (Auction auction in list) { auction.Price = CurrencyConverter.ConvertMoney(auction.Price); } return(list); }
public IEnumerable <Aukcje.Auction> SelectItems() { IEnumerable <Auction> list = new List <Auction>(); using (var ctx = new bazaEntities()) { list = ctx.Auctions.ToList(); list = list.Where(p => p.ID == Convert.ToInt32(HttpContext.Current.Request.QueryString["ID"])); } foreach (Auction auction in list) { auction.Price = CurrencyConverter.ConvertMoney(auction.Price); } return(list); }
public IEnumerable SelectAuctionsList() { IEnumerable <Auction> list; using (var ctx = new bazaEntities()) { list = ctx.Auctions.ToList(); } list = list.Where(p => p.status == "otwarte"); //catgory filtering if ((int)view.FilterCategory < 3) { list = list.Where(p => p.Category == (int)view.FilterCategory); // ((Aukcje.Site)this.Page.Master).changeValueInDropDowCategoryList((int)category); } if (!String.IsNullOrEmpty(view.SearchedItem)) { list = list.Where(p => (p.Title.IndexOf(view.SearchedItem, StringComparison.OrdinalIgnoreCase) >= 0)); // ((Aukcje.Site)this.Page.Master).changeValueInTextSearchBar(SearchedItem); } list = list.Where(p => p.Price >= view.FilterLowPrice && p.Price <= view.FilterHighPrice); //color filtering foreach (ListItem listItem in view.FilterColorCheckBoxList.Items) { if (listItem.Selected) { list = list.Where(p => (view.FilterColorCheckBoxList.Items[0].Selected ? p.Color == 0 : false) || (view.FilterColorCheckBoxList.Items[1].Selected ? p.Color == 1 : false) || (view.FilterColorCheckBoxList.Items[2].Selected ? p.Color == 2 : false) ); break; } } foreach (Auction auction in list) { auction.Price = CurrencyConverter.ConvertMoney(auction.Price); } return(list); }