コード例 #1
0
        public ActionResult Edit(Enrollment enrollment)
        {
            if (ModelState.IsValid)
            {
                db.Entry(enrollment).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            // only active program list for non-admins
            if (User.IsInRole("Admin"))
            {
                var _athletes = db.Athletes
                                .OrderBy(a => a.LastName)
                                .OrderBy(a => a.FirstName);

                ViewBag.AthleteID = new SelectList(_athletes, "AthleteID", "FullName", enrollment.AthleteID);
            }
            else
            {
                var _athletes = db.Athletes
                                .Where(a => a.Email == User.Identity.Name);

                ViewBag.AthleteID = new SelectList(_athletes, "AthleteID", "FullName", enrollment.AthleteID);
            }

            ViewBag.AthleteID = new SelectList(db.Athletes, "AthleteID", "FullName", enrollment.AthleteID);
            ViewBag.ProgramID = new SelectList(db.Programs, "ProgramID", "Title", enrollment.ProgramID);
            return(View(enrollment));
        }
コード例 #2
0
 public ActionResult Edit(Athlete athlete)
 {
     if (ModelState.IsValid)
     {
         db.Entry(athlete).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(athlete));
 }
コード例 #3
0
 public ActionResult Edit(Program program)
 {
     if (ModelState.IsValid)
     {
         db.Entry(program).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(program));
 }
コード例 #4
0
 public ActionResult Edit(ReceiptData receiptdata)
 {
     if (ModelState.IsValid)
     {
         db.Entry(receiptdata).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(receiptdata));
 }
コード例 #5
0
 public ActionResult Edit(VolunteerRoles volunteerroles)
 {
     if (ModelState.IsValid)
     {
         db.Entry(volunteerroles).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(volunteerroles));
 }
コード例 #6
0
 public ActionResult Edit(VolunteerCommitments volunteercommitments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(volunteercommitments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     // ViewBag.EventID = new SelectList(db.VolunteerEvents, "EventID", "EventName", volunteercommitments.EventID);
     PopulateEventDropDownList(volunteercommitments.EventID);
     ViewBag.RoleID = new SelectList(db.VolunteerRoles, "RoleID", "Role", volunteercommitments.RoleID);
     return(View(volunteercommitments));
 }