public async Task <IActionResult> PutVazeceDoze(int id, VazeceDoze vazeceDoze) { if (id != vazeceDoze.DozaKrviId) { return(BadRequest()); } _context.Entry(vazeceDoze).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VazeceDozeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <VazeceDoze> > PostVazeceDoze(VazeceDoze vazeceDoze) { _context.VazeceDoze.Add(vazeceDoze); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (VazeceDozeExists(vazeceDoze.DozaKrviId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetVazeceDoze", new { id = vazeceDoze.DozaKrviId }, vazeceDoze)); }