Beispiel #1
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                ModelState.AddModelError(string.Empty, "There was an error while getting user!");
            }

            Users user = new Users();

            using (var httpClient = new HttpClient())
            {
                user = await GetAPI.GetUserAsync(httpClient, id);

                Rolet rolet = await GetAPI.GetRoletAsync(httpClient, id);

                user.Role = rolet;
            }

            if (user == null)
            {
                ModelState.AddModelError(string.Empty, "There was an error while getting user!");
            }

            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> EditForm(int id)
        {
            Users user = new Users();

            using (var httpClient = new HttpClient())
            {
                user = await GetAPI.GetUserAsync(httpClient, id);

                List <Rolet> MyRolets = await GetAPI.GetRoletListAsync(httpClient);

                ViewData["RoleId"] = new SelectList(MyRolets, "RoletId", "RoleName");
            }

            return(View(user));
        }