예제 #1
0
        public async Task <IActionResult> Edit(int id, PetBio petBio)
        {
            if (id != petBio.PetBioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(petBio);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PetBioExists(petBio.PetBioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["PetId"] = new SelectList(_context.PetAccounts, "PetAccountId", "PetAccountId", petBio.PetId);
            return(View(petBio));
        }
예제 #2
0
        // GET: PetBios/Create
        public IActionResult Create(int petAccountid)
        {
            PetBio petBio = new PetBio();

            petBio.PetId = petAccountid;


            return(View(petBio));
        }
예제 #3
0
        public async Task <IActionResult> Create(PetBio petBio)
        {
            //petBio.PetAccount = _repo.PetBio.GetAssociatedPet(petBio.PetBioId);


            if (ModelState.IsValid)
            {
                _repo.PetBio.Create(petBio);
                _repo.Save();
                return(RedirectToAction("Details", new { id = petBio.PetId }));
            }

            return(View(petBio));
        }