public async Task <IActionResult> PutTmaxTrainCurrent(long id, TmaxTrainCurrent tmaxTrainCurrent) { if (id != tmaxTrainCurrent.TmaxTrainCurrentId) { return(BadRequest()); } _context.Entry(tmaxTrainCurrent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TmaxTrainCurrentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TmaxTrainCurrent> > PostTmaxTrainCurrent(TmaxTrainCurrent tmaxTrainCurrent) { _context.TmaxTrainCurrent.Add(tmaxTrainCurrent); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TmaxTrainCurrentExists(tmaxTrainCurrent.TmaxTrainCurrentId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTmaxTrainCurrent", new { id = tmaxTrainCurrent.TmaxTrainCurrentId }, tmaxTrainCurrent)); }