Beispiel #1
0
        public async Task <IActionResult> ElseWhatsSuppTonight(int?dinerId)
        {
            SeeWhatsSuppVM seeWhatsSuppVM = new SeeWhatsSuppVM();
            //get diner2 (user)
            var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            seeWhatsSuppVM.Diner2 = await _repo.Diner.FindDiner(userId);

            //get diner1 (who started the WhatsSupp)
            seeWhatsSuppVM.Diner = await _repo.Diner.FindDinerByDinerId(dinerId);

            //get a match to display
            seeWhatsSuppVM.PotentialMatch = await _repo.PotentialMatch.GetOneToMatch(seeWhatsSuppVM.Diner.DinerId, seeWhatsSuppVM.Diner2.DinerId);

            if (seeWhatsSuppVM.PotentialMatch == null)
            {
                return(RedirectToAction("index"));
            }
            ;
            var results = await _repo.PotentialMatch.GetAllMatches(seeWhatsSuppVM.Diner.DinerId, seeWhatsSuppVM.Diner2.DinerId);

            seeWhatsSuppVM.Matches = results.ToList();

            return(View(seeWhatsSuppVM));
        }
Beispiel #2
0
        public async Task <IActionResult> MyWhatsSuppTonight()
        {
            SeeWhatsSuppVM seeWhatsSuppVM = new SeeWhatsSuppVM();
            //get diner1
            var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            seeWhatsSuppVM.Diner = await _repo.Diner.FindDiner(userId);

            //get an option to display
            seeWhatsSuppVM.PotentialMatch = await _repo.PotentialMatch.GetOneToMatch(seeWhatsSuppVM.Diner.DinerId);

            if (seeWhatsSuppVM.PotentialMatch == null)
            {
                return(RedirectToAction("index"));
            }
            ;

            //get diner2
            seeWhatsSuppVM.Diner2 = await _repo.Diner.FindDinerByDinerId(seeWhatsSuppVM.PotentialMatch.Diner2Id);

            var results = await _repo.PotentialMatch.GetAllMatches(seeWhatsSuppVM.Diner.DinerId, seeWhatsSuppVM.Diner2.DinerId);

            seeWhatsSuppVM.Matches = results.ToList();
            //return view with VM
            return(View(seeWhatsSuppVM));
        }