public IActionResult Teams(Attendee model)
        {
            var attendee = _attendeeProvider.GetAttendee(model.code, null);

            if (attendee == null || (attendee.isTemp ?? false) == true)
            {
                return(Redirect("/vote?e=o"));
            }
            else if (attendee.voteTeamId != null)
            {
                return(Redirect("/vote?e=d"));
            }
            else
            {
                var teams = _teamProvider.GetTeams();
                ViewData["attendeeCode"] = attendee.code;
                return(View("Teams", teams));
            }

            // var teams = _teamProvider.GetTeams();
            // if (attendee != null) {
            //     ViewData["attendeeCode"] = attendee.code;
            //     return View("Teams", teams);
            // } else {
            //     isSuccess = false;
            //     return Redirect("/vote");
            // }
        }
Exemple #2
0
        public async Task <IActionResult> GetTeams([FromQuery] string searchTerm)
        {
            var companyId = this.User.Claims.SingleOrDefault(c => c.Type == "companyId").Value;
            var teams     = await teamProvider.GetTeams(companyId, searchTerm);

            var teamViewModelList = mapper.Map <List <TeamViewModel> >(teams);

            return(Ok(teamViewModelList));
        }