public ActionResult Edit([Bind(Include = "Id,Name,CampusCode")] Campus campus) { if (ModelState.IsValid) { db.Entry(campus).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(campus)); }
public ActionResult Edit(DepartmentViewModel model) { if (ModelState.IsValid) { Department dept = new Department(); dept.Id = model.Id; dept.Name = model.Name; dept.DeptCode = model.DeptCode; dept.CampusId = model.CampusId; db.Entry(dept).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CampusList = db.Campuses.ToList(); return(View(model)); }
public ActionResult Edit(ConsultantViewModel model) { if (ModelState.IsValid) { Consultant consul = new Consultant(); consul.Id = model.Id; consul.Name = model.Name; consul.Phone = model.Phone; consul.Email = model.Email; consul.Address = model.Address; consul.DeptId = model.DeptId; consul.Status = model.Status; db.Entry(consul).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentsList = db.Departments.ToList(); return(View(model)); }