//Find the associated auctions for a user public void GetUserAuctions(UserShowModel user) { AuctionShowModel.Clear(); foreach (AuctionModel auctionModel in auctionRepos.getAuctionsByUserName(user.UserName)) { if (FirstChildViewModel == null) { FirstChildViewModel = new FirstChildViewModel(); } AuctionShowModel.Add(FirstChildViewModel.ConvertAuctionModelToAuctionShowModel(auctionModel)); } }
//Select an auction and do something. private void Auctions_SelectionChanged(object sender, SelectionChangedEventArgs e) { AuctionShowModel SelectedAuction = null; if (e.AddedItems.Count > 0) { SelectedAuction = e.AddedItems[0] as AuctionShowModel; sCWM.SelectedAuction = SelectedAuction; } else { MessageBox.Show("No auction was selected!"); } }
public AuctionShowModel ConvertAuctionModelToAuctionShowModel(AuctionModel auctionModel) { AuctionShowModel auctionShowModel = new AuctionShowModel { Id = auctionModel.Id, StartPrice = auctionModel.StartPrice, BuyOutPrice = auctionModel.BuyOutPrice, BidInterval = auctionModel.BidInterval, StartDate = auctionModel.StartDate, EndDate = auctionModel.EndDate, Description = auctionModel.Description, Category = auctionModel.Category, UserName = auctionModel.UserName, }; return(auctionShowModel); }