public async Task <IActionResult> PutErostering(short id, Erostering erostering) { if (id != erostering.ErosteringId) { return(BadRequest()); } _context.Entry(erostering).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ErosteringExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Erostering> > PostErostering(Erostering erostering) { _context.Erostering.Add(erostering); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ErosteringExists(erostering.ErosteringId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetErostering", new { id = erostering.ErosteringId }, erostering)); }