Esempio n. 1
0
        public ActionResult Create(Professor professor)
        {
            if (ModelState.IsValid)
            {
                db.Professors.Add(professor);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.TermStatusID = new SelectList(db.TermStatus, "TermStatusID", "Status", professor.TermStatusID);
            ViewBag.WorkStatusID = new SelectList(db.WorkStatus, "WorkStatusID", "Status", professor.WorkStatusID);
            ViewBag.DesignationID = new SelectList(db.Designation, "DesignationID", "Title", professor.DesignationID);
            return View(professor);
        }
Esempio n. 2
0
 public ActionResult Edit(Professor professor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(professor).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.TermStatusID = new SelectList(db.TermStatus, "TermStatusID", "Status", professor.TermStatusID);
     ViewBag.WorkStatusID = new SelectList(db.WorkStatus, "WorkStatusID", "Status", professor.WorkStatusID);
     ViewBag.LocationID = new SelectList(db.Location, "LocationID", "Name", professor.LocationID);
     ViewBag.DesignationID = new SelectList(db.Designation, "DesignationID", "Title", professor.DesignationID);
     return View(professor);
 }