Exemplo n.º 1
0
        public ActionResult GetBidsList(string state, int?userId, bool isPartial = false)
        {
            IEnumerable <BidViewModel> model;

            if (User.IsInRole("User"))
            {
                userId = _userService.GetUserByEmail(User.Identity.Name).Id;
            }
            switch (state)
            {
            case ("Current"):
                model = _bidService.GetAllBidEntitiesForSaleLots().Where(b => b.UserId == userId).Select(b => b.ToMvcBid());
                break;

            case ("All"):
            default:
                model = _bidService.GetAllBidEntities().Where(b => b.UserId == userId).Select(b => b.ToMvcBid());
                break;
            }
            ViewBag.State = state;
            if (isPartial)
            {
                return(PartialView("_GetBidsList", model));
            }
            return(View(model));
        }