public async Task <IActionResult> JeloUpsert(int id = 0) { var kategorijeResponse = await _restoranApi.GetKategorijaAsync(); var model = new JeloUpsert(); if (id != 0) { var response = await _restoranApi.GetJeloByIdAsync(id); if (response.IsSuccessStatusCode) { model = _mapper.Map <JeloUpsert>(response.Content); } } model.Kategorije = kategorijeResponse.Content.Data.Select ( i => new SelectListItem() { Text = i.Naziv, Value = i.ID.ToString() } ).ToList(); return(View(model)); }