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)); }
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)); }
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)); }