public async Task <IActionResult> PutTmaxTrainCurrentType(byte id, TmaxTrainCurrentType tmaxTrainCurrentType) { if (id != tmaxTrainCurrentType.TmaxTrainCurrentTypeId) { return(BadRequest()); } _context.Entry(tmaxTrainCurrentType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TmaxTrainCurrentTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TmaxTrainCurrentType> > PostTmaxTrainCurrentType(TmaxTrainCurrentType tmaxTrainCurrentType) { _context.TmaxTrainCurrentType.Add(tmaxTrainCurrentType); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TmaxTrainCurrentTypeExists(tmaxTrainCurrentType.TmaxTrainCurrentTypeId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTmaxTrainCurrentType", new { id = tmaxTrainCurrentType.TmaxTrainCurrentTypeId }, tmaxTrainCurrentType)); }