Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 private void Button3_Click(object sender, RoutedEventArgs e)
 {
     GuidedTour.MoveNext();
 }