public async Task <IActionResult> Edit(int id, [Bind("Id,IdUsluga,IdReferentniTip")] UslugaReferentniTip uslugaReferentniTip) { if (id != uslugaReferentniTip.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(uslugaReferentniTip); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UslugaReferentniTipExists(uslugaReferentniTip.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdReferentniTip"] = new SelectList(_context.ReferentniTip, "Id", "Naziv", uslugaReferentniTip.IdReferentniTip); ViewData["IdUsluga"] = new SelectList(_context.Usluga, "Id", "Naziv", uslugaReferentniTip.IdUsluga); return(View(uslugaReferentniTip)); }
public async Task <IActionResult> Create([Bind("Id,IdUsluga,IdReferentniTip")] UslugaReferentniTip uslugaReferentniTip) { if (ModelState.IsValid) { _context.Add(uslugaReferentniTip); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdReferentniTip"] = new SelectList(_context.ReferentniTip, "Id", "Naziv", uslugaReferentniTip.IdReferentniTip); ViewData["IdUsluga"] = new SelectList(_context.Usluga, "Id", "Naziv", uslugaReferentniTip.IdUsluga); return(View(uslugaReferentniTip)); }