public async Task <IActionResult> UposlenikDetalji(int id = 0) { var ulogeResponse = await _restoranApi.GetUlogaAsync(); var gradResponse = await _restoranApi.GetGradAsync(); var model = new UposlenikDetalji(); var response = await _restoranApi.GetKorisnikByIdAsync(id); if (response.IsSuccessStatusCode) { model = _mapper.Map <UposlenikDetalji>(response.Content); model.TrenutneUloge = response.Content.Uloge.Select(i => i.Id).ToList(); foreach (var item in ulogeResponse.Content.Data) { var IsSelected = model.TrenutneUloge.Contains(item.Id); model.SveUloge.Add ( new KorisnikUlogaCheckListItem { Id = item.Id, Name = item.Name, IsSelected = IsSelected } ); } } model.Gradovi = gradResponse.Content.Data.Select ( i => new SelectListItem() { Text = i.Naziv, Value = i.ID.ToString() } ).ToList(); return(View(model)); }