예제 #1
0
        public ActionResult ViewMyAuctions()
        {
            AuctionatorContext _context = new AuctionatorContext();
            List <Auction>     auctions = new List <Auction>();
            User user = Session["user"] as User;

            if (user != null)
            {
                _context.Auctions.ToList().ForEach((a) => {
                    if (a.Seller == user.Id)
                    {
                        auctions.Add(a);
                    }
                });
                ViewAuctionsViewModel viewAuctionsViewModel = new ViewAuctionsViewModel
                {
                    auctions = auctions
                };
                return(View(viewAuctionsViewModel));
            }
            else
            {
                return(Redirect("/login/login"));
            }
        }
예제 #2
0
        public ActionResult ViewAllAuctions()
        {
            List <Auction>     auctions = new List <Auction>();
            AuctionatorContext _context = new AuctionatorContext();

            _context.Auctions.ToList().ForEach((a) => {
                auctions.Add(a);
            });
            ViewAuctionsViewModel viewAuctionsViewModel = new ViewAuctionsViewModel
            {
                auctions = auctions
            };

            return(View(viewAuctionsViewModel));
        }