Exemplo n.º 1
0
        public ActionResult Create(Breed breed)
        {
            if (ModelState.IsValid)
            {
                db.Breeds.Add(breed);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.PetTypeId = new SelectList(db.PetTypes, "Id", "Name", breed.PetTypeId);
            return View(breed);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Breed breed)
 {
     if (ModelState.IsValid)
     {
         db.Entry(breed).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.PetTypeId = new SelectList(db.PetTypes, "Id", "Name", breed.PetTypeId);
     return View(breed);
 }