public async Task <IActionResult> Edit(int id, [Bind("PetId,CustomerId,EmailAddress,PetName,Species,Breed,Birthday")] Pet pet)
        {
            if (id != pet.PetId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PetExists(pet.PetId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pet));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("AppointmentId,CustomerId,PetId,AppointmentDate,CreatedDate")] Appointment appointment)
        {
            if (id != appointment.AppointmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appointment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentExists(appointment.AppointmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(appointment));
        }