public async Task <IActionResult> PutEtrainRadio(short id, EtrainRadio etrainRadio) { if (id != etrainRadio.EtrainRadioId) { return(BadRequest()); } _context.Entry(etrainRadio).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EtrainRadioExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <EtrainRadio> > PostEtrainRadio(EtrainRadio etrainRadio) { _context.EtrainRadio.Add(etrainRadio); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EtrainRadioExists(etrainRadio.EtrainRadioId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEtrainRadio", new { id = etrainRadio.EtrainRadioId }, etrainRadio)); }