public async Task <IActionResult> Puttransportations([FromRoute] int id, [FromBody] transportations transportations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != transportations.id) { return(BadRequest()); } _context.Entry(transportations).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!transportationsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Posttransportations([FromBody] transportations transportations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.transportations.Add(transportations); await _context.SaveChangesAsync(); return(CreatedAtAction("Gettransportations", new { id = transportations.id }, transportations)); }