Exemple #1
0
        public ActionResult AllCardsForLead(int leadId)
        {
            Web.ViewModel.AllCardsViewModel multipleCards = new AllCardsViewModel();
            var results = _service.GetAllCardsForLead(leadId);

            multipleCards.cards = results;

            return(View(multipleCards));
        }
Exemple #2
0
        public async Task <IActionResult> Index()
        {
            var model = new AllCardsViewModel()
            {
                ActiveCards  = await this.cardsService.GetActiveCardsAsync <CardViewModel>(),
                ExpiredCards = await this.cardsService.GetExpiredCardsAsync <CardViewModel>(),
            };

            await this.GetClientUsernameAsync(model);

            return(this.View(model));
        }
Exemple #3
0
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }
            var allCardsViewModel = new AllCardsViewModel
            {
                Cards = this.cardsService.AllCards(),
            };

            return(this.View(allCardsViewModel));
        }
Exemple #4
0
        public HttpResponse Collection()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }
            var collectionViewModel = new AllCardsViewModel
            {
                Cards = this.cardsService.MyCollection(this.User),
            };

            return(this.View(collectionViewModel));
        }
        public HttpResponse Collection()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            var viewModel = new AllCardsViewModel()
            {
                Cards = this.cardsService.ReturnUserCollectioncards(this.User)
            };

            return(this.View(viewModel));
        }
Exemple #6
0
        private async Task GetClientUsernameAsync(AllCardsViewModel model)
        {
            for (int i = 0; i < model.ActiveCards.Count(); i++)
            {
                var currentCardModel = model.ActiveCards.ToList()[i];

                currentCardModel.ClientUsername = await this.usersService.GetUsernameByIdAsync(currentCardModel.ClientId);
            }

            for (int i = 0; i < model.ExpiredCards.Count(); i++)
            {
                var currentCardModel = model.ExpiredCards.ToList()[i];

                currentCardModel.ClientUsername = await this.usersService.GetUsernameByIdAsync(currentCardModel.ClientId);
            }
        }
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            // ?? WHY this doesn't work ??
            //var cardsViewModel = this.cardsService.GetAll();
            //return this.View(cardsViewModel);

            AllCardsViewModel allCards = new AllCardsViewModel()
            {
                AllCards = this.cardsService.GetAll().ToList(),
            };

            return(this.View(allCards));
        }
        public IActionResult AllCards()
        {
            string currUserEmail = HttpContext.Session.GetString("User");

            AllCardsViewModel model = new AllCardsViewModel();

            User currUser       = dbContext.Users.Where(u => u.email == currUserEmail).FirstOrDefault();
            var  allCardsOfUser = dbContext.Users.Where(u => u.UserID == currUser.UserID).SelectMany(u => u.CreditCards).ToList();

            if (allCardsOfUser == null)
            {
                ViewData["CreditCards"] = "You have not added any cards";
            }
            else
            {
                model.userCards = allCardsOfUser;
            }
            return(View(model));
        }
Exemple #9
0
        public ActionResult EditCard(int leadId)
        {
            Web.ViewModel.CardStackViewModel singleCard    = new ViewModel.CardStackViewModel();
            Web.ViewModel.AllCardsViewModel  multipleCards = new AllCardsViewModel();
            var results = _service.GetAllCardsForLead(leadId);

            multipleCards.cards = results;

            var username = HttpContext.User.Identity.Name;

            singleCard.user = _UserRepository.GetUserByUsername(username);
            singleCard.card = multipleCards.cards.Last();
            singleCard.card = new Card()
            {
                ParentLeadId = leadId
            };
            singleCard.card.LastUpdated = DateTime.Now;

            singleCard.card = multipleCards.cards.Last();

            return(View(singleCard));
        }
Exemple #10
0
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }
            var viewModel = new AllCardsViewModel
            {
                Cards = this.cardsService.GetAll().Select(x => new CardsViewModel
                {
                    CardId      = x.Id,
                    Name        = x.Name,
                    ImageUrl    = x.ImageUrl,
                    Attack      = x.Attack,
                    Health      = x.Health,
                    Keyword     = x.Keyword,
                    Description = x.Description,
                })
            };

            return(this.View(viewModel));
        }