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); }
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); }