Ejemplo n.º 1
0
        public ActionResult Create(Donation donation)
        {
            if (ModelState.IsValid)
            {
                db.Donations.Add(donation);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.EmployeeKey = new SelectList(db.Employees, "EmployeeKey", "EmployeeSSNumber", donation.EmployeeKey);
            ViewBag.PersonKey = new SelectList(db.People, "PersonKey", "PersonLastName", donation.PersonKey);
            return View(donation);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Donation donation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(donation).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.EmployeeKey = new SelectList(db.Employees, "EmployeeKey", "EmployeeSSNumber", donation.EmployeeKey);
     ViewBag.PersonKey = new SelectList(db.People, "PersonKey", "PersonLastName", donation.PersonKey);
     return View(donation);
 }