public async Task <IActionResult> PutTmechanicalWagonCouplerType(long id, TmechanicalWagonCouplerType tmechanicalWagonCouplerType) { if (id != tmechanicalWagonCouplerType.TmechanicalWagonCouplerTypeId) { return(BadRequest()); } _context.Entry(tmechanicalWagonCouplerType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TmechanicalWagonCouplerTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TmechanicalWagonCouplerType> > PostTmechanicalWagonCouplerType(TmechanicalWagonCouplerType tmechanicalWagonCouplerType) { _context.TmechanicalWagonCouplerType.Add(tmechanicalWagonCouplerType); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TmechanicalWagonCouplerTypeExists(tmechanicalWagonCouplerType.TmechanicalWagonCouplerTypeId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTmechanicalWagonCouplerType", new { id = tmechanicalWagonCouplerType.TmechanicalWagonCouplerTypeId }, tmechanicalWagonCouplerType)); }