コード例 #1
0
 public ActionResult Edit(FinanceDonation financedonation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(financedonation).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.EventID = new SelectList(db.Events, "EventID", "Title", financedonation.EventID);
     ViewBag.UserID = new SelectList(db.Users, "UserID", "LastName", financedonation.UserID);
     return View(financedonation);
 }
コード例 #2
0
        public ActionResult Create(FinanceDonation financedonation)
        {
            if (ModelState.IsValid)
            {
                db.FinanceDonations.Add(financedonation);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            ViewBag.EventID = new SelectList(db.Events, "EventID", "Title", financedonation.EventID);
            ViewBag.UserID = new SelectList(db.Users, "UserID", "LastName", financedonation.UserID);
            return View(financedonation);
        }