public async Task <IActionResult> PutTourOperators([FromRoute] int id, [FromBody] TourOperators tourOperators) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tourOperators.TourOperatorId) { return(BadRequest()); } _context.Entry(tourOperators).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TourOperatorsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTourOperators([FromBody] TourOperators tourOperators) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TourOperators.Add(tourOperators); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTourOperators", new { id = tourOperators.TourOperatorId }, tourOperators)); }