public ActionResult Create(Donation donation) { if (ModelState.IsValid) { db.Donations.Add(donation); db.SaveChanges(); return RedirectToAction("Index"); } //ViewBag.DonationType = new SelectList(db.DonationTypeIDs, "DonationTypeID1", "DonationDesc", donation.DonationType); ViewBag.DonorID = new SelectList(DonorsSelectListQuery(), "DonorID", "FullName", donation.DonorID); return View(donation); }
public ActionResult Edit(Donation donation) { if (ModelState.IsValid) { db.Entry(donation).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.DonationType = new SelectList(db.DonationTypeIDs, "DonationTypeID1", "DonationDesc", donation.DonationType); ViewBag.DonorID = new SelectList(db.Donors, "DonorID", "FastName", donation.DonorID); return View(donation); }