Esempio n. 1
0
        // GET: Member
        public async Task <IActionResult> Index()
        {
            IEnumerable <Member> members = await memberClient.GetMembersAsync();

            /* IEnumerable<Team> teams = await teamClient.GetTeamsAsync();
             * var memberViewModelsList = from item in members
             *                          select new MemberViewModel()
             *                          {
             *                              MemberId = item.MemberId,
             *                              Name = item.Name,
             *                              TeamId = item.TeamId,
             *                              TeamName = teams.FirstOrDefault(t => t.TeamId == item.TeamId)?.Name ?? string.Empty
             *                           };*/

            var memberViewModelsList = from item in members
                                       select new MemberViewModel()
            {
                MemberId = item.MemberId,
                Name     = item.Name,
                TeamId   = item.TeamId,
                TeamName = teamClient.GetTeamAsync(item.TeamId).Result?.Name ?? string.Empty
            };



            return(View(memberViewModelsList));
        }
Esempio n. 2
0
        // GET: Team/Details/5
        public async Task <IActionResult> Details(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var team = await teamClient.GetTeamAsync(id);

            if (team == null)
            {
                return(NotFound());
            }

            return(View(new TeamViewModel()
            {
                TeamId = team.TeamId, Name = team.Name
            }));
        }