public async Task <IActionResult> PutTouristDestinations([FromRoute] int id, [FromBody] TouristDestinations touristDestinations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != touristDestinations.TouristDestinationId) { return(BadRequest()); } _context.Entry(touristDestinations).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TouristDestinationsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTouristDestinations([FromBody] TouristDestinations touristDestinations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TouristDestinations.Add(touristDestinations); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTouristDestinations", new { id = touristDestinations.TouristDestinationId }, touristDestinations)); }