public async Task <IActionResult> PutDrzava(int id, Drzava drzava) { if (id != drzava.ID) { return(BadRequest()); } _context.Entry(drzava).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrzavaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutNaselje(int id, Naselje naselje) { if (id != naselje.ID) { return(BadRequest()); } naselje.Drzava = _context.Drzava.First(d => d.ID.Equals(naselje.Drzava.ID)); _context.Entry(naselje).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NaseljeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }