public async Task <IActionResult> IndexAsync() { List <Users> MyUsers = new List <Users>(); List <Rolet> MyRolets = new List <Rolet>(); using (var httpClient = new HttpClient()) { MyUsers = await GetAPI.GetUserListAsync(httpClient); MyRolets = await GetAPI.GetRoletListAsync(httpClient); ViewBag.JsonUser = await GetJsonXml.GetJsonUser(httpClient); ViewBag.XmlUser = await GetJsonXml.GetXmlUser(httpClient); ViewBag.JsonRolet = await GetJsonXml.GetJsonRolet(httpClient); ViewBag.XmlRolet = await GetJsonXml.GetXmlRolet(httpClient); } foreach (var user in MyUsers) { foreach (var role in MyRolets) { if (user.RoleId == role.RoletId) { user.Role = role; } } } return(View(MyUsers)); }
public async Task <IActionResult> Index() { List <Rolet> MyRolets = new List <Rolet>(); using (var httpClient = new HttpClient()) { MyRolets = await GetAPI.GetRoletListAsync(httpClient); ViewBag.JsonRolet = await GetJsonXml.GetJsonRolet(httpClient); ViewBag.XmlRolet = await GetJsonXml.GetXmlRolet(httpClient); } return(View(MyRolets)); }