コード例 #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));
        }
コード例 #2
0
        public async Task <IActionResult> EditForm(int id)
        {
            Rolet rolet = new Rolet();

            using (var httpClient = new HttpClient())
            {
                rolet = await GetAPI.GetRoletAsync(httpClient, id);
            }

            return(View(rolet));
        }
コード例 #3
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                ModelState.AddModelError(string.Empty, "Ka ndodhur nje gabim gjate marrjes te rolit!");
            }

            Rolet rolet = new Rolet();

            using (var httpClient = new HttpClient())
            {
                rolet = await GetAPI.GetRoletAsync(httpClient, id);
            }

            if (rolet == null)
            {
                ModelState.AddModelError(string.Empty, "Ka ndodhur nje gabim gjate marrjes te rolit!");
            }

            return(View(rolet));
        }