public async Task <IActionResult> PutEtrainProtectionElements(long id, EtrainProtectionElements etrainProtectionElements) { if (id != etrainProtectionElements.EtrainProtectionElementsId) { return(BadRequest()); } _context.Entry(etrainProtectionElements).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EtrainProtectionElementsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <EtrainProtectionElements> > PostEtrainProtectionElements(EtrainProtectionElements etrainProtectionElements) { _context.EtrainProtectionElements.Add(etrainProtectionElements); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EtrainProtectionElementsExists(etrainProtectionElements.EtrainProtectionElementsId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEtrainProtectionElements", new { id = etrainProtectionElements.EtrainProtectionElementsId }, etrainProtectionElements)); }