Esempio n. 1
0
        public List <BLLLot> GetLotsByTabName(string tabName, string currentUserEmail)
        {
            List <BLLLot> lots;

            if (tabName == TabNameMyLots)
            {
                lots = _crudLotService.GetAllLotsOfUser(currentUserEmail).ToList();
            }
            else if (tabName == TabNameMyRates)
            {
                var userId = _crudUserService.GetUserByEmail(currentUserEmail).Id;
                lots = _crudLotService.GetAllLots()
                       .Where(l => l.UsersLotsRates.Any(ulr => ulr.UserId == userId) &&
                              l.LotIsFinishedAuction == false).ToList();
            }
            else if (tabName == TabNameMyWinsLots)
            {
                var userId = _crudUserService.GetUserByEmail(currentUserEmail).Id;
                lots = _crudLotService.GetAllLots().Where(l => l.CurrentBuyerId == userId &&
                                                          l.LotIsFinishedAuction).ToList();
            }
            else
            {
                lots = _crudLotService.GetAllLots().Where(l => l.LotIsFinishedAuction == false).ToList();
            }

            return(lots);
        }
        public ActionResult About()
        {
            var aboutModel = new AboutModel()
            {
                CountUsers = _crudUserService.GetAllUsers().Count(),
                CountSoldLots = _crudLotService.GetAllLots().Count(l => l.LotIsFinishedAuction && l.CurrentBuyerId != 0),
                CountActiveLots = _crudLotService.GetAllLots().Count(l => l.LotIsFinishedAuction == false)
            };

            if (User.Identity.IsAuthenticated && User.IsInRole("banned"))
            {
                ViewBag.Message = "You was banned. To determine the cause you may write by mail [email protected]";
            }

			return View(aboutModel);
		}