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

            return View(adoption);
        }
Exemplo n.º 2
0
        public ActionResult Adopting(int petid = 0)
        {
            Customer currentUser = (Customer)Session["currentUser"];
            int customerId = currentUser.CustomerId;

            Adoption newadoption = new Adoption();
            newadoption.AdoptDate = DateTime.Now;
            newadoption.CustomerId = customerId;
            newadoption.status = "Pending";
            db.Adoptions.Add(newadoption);

            Pet thispet = db.Pets.Find(petid);
            thispet.AdoptionId = newadoption.AdoptionId;
            db.SaveChanges();

            return View(newadoption);
        }
Exemplo n.º 3
0
 public ActionResult Edit(Adoption adoption)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adoption).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(adoption);
 }