Esempio n. 1
0
        public ActionResult Create(Training training)
        {
            if (ModelState.IsValid)
            {
                db.Trainings.Add(training);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.traineeId = new SelectList(db.Trainees, "id", "name", training.traineeId);
            return View(training);
        }
Esempio n. 2
0
 public ActionResult Edit(Training training)
 {
     if (ModelState.IsValid)
     {
         db.Entry(training).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.traineeId = new SelectList(db.Trainees, "id", "name", training.traineeId);
     return View(training);
 }