Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "ID,UserID,Subject,Content")] Article article)
 {
     if (ModelState.IsValid)
     {
         db.Entry(article).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(article));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,UserID")] Instructor instructor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(instructor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserID = new SelectList(db.Users.Select(u => new { ID = u.ID, Name = u.Name + " " + u.Surname }), "ID", "Name");
     return(View(instructor));
 }
 public ActionResult Edit([Bind(Include = "ID,UserID,InstructorID,Date,Place")] IndividualTraining individualTraining)
 {
     if (ModelState.IsValid)
     {
         db.Entry(individualTraining).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "ID", individualTraining.InstructorID);
     ViewBag.UserID       = new SelectList(db.Users, "ID", "UserName", individualTraining.UserID);
     return(View(individualTraining));
 }