Exemple #1
0
        public async Task <IActionResult> Create([Bind("ID,LastName,FirstName,EnrollmentDate,City,EmailAddress,PhoneNumber,Occupation")] Owner owner)
        {
            if (ModelState.IsValid)
            {
                _context.Add(owner);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(owner));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ID,Name,DOB,OwnerID,Breed")] Pet pet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OwnerID"] = new SelectList(_context.Owner, "ID", "ID", pet.OwnerID);
            return(View(pet));
        }