public async Task <IActionResult> PutGuidedTour([FromRoute] decimal id, [FromBody] GuidedTour guidedTour) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != guidedTour.Id) { return(BadRequest()); } _context.Entry(guidedTour).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GuidedTourExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostGuidedTour([FromBody] GuidedTour guidedTour) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.GuidedTour.Add(guidedTour); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (GuidedTourExists(guidedTour.Id)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetGuidedTour", new { id = guidedTour.Id }, guidedTour)); }
private void Button3_Click(object sender, RoutedEventArgs e) { GuidedTour.MoveNext(); }