public async Task <IActionResult> Edit(int id, [Bind("Id,ProizvodjacId,Tip,TrgovinaId,PredajaOglasa,Cijena,Dostupnost,Kontakt")] Availabilities availabilities) { if (id != availabilities.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(availabilities); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AvailabilitiesExists(availabilities.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProizvodjacId"] = new SelectList(_context.Producer, "Id", "Naziv", availabilities.ProizvodjacId); ViewData["TrgovinaId"] = new SelectList(_context.Market, "Id", "Naziv", availabilities.TrgovinaId); return(View(availabilities)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Naziv")] Market market) { if (id != market.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(market); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MarketExists(market.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(market)); }