コード例 #1
0
        public async Task <IActionResult> Create([Bind("PetId,CustomerId,EmailAddress,PetName,Species,Breed,Birthday")] Pet pet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pet));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("AppointmentId,CustomerId,PetId,AppointmentDate,CreatedDate")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appointment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(appointment));
        }