Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }