public ActionResult Create() { var db = new userDao(); ViewBag.dsNv = new MultiSelectList(db.listAll(), "ID", "Name"); return(View()); }
//view update public ActionResult Edit(int id) { var w = new workDao().viewDetail(id); var updateProject = new updateProject(); updateProject.Id = w.Id; updateProject.nameProject = w.nameProject; updateProject.nameLeader = w.Leader; updateProject.dateWork = w.dateWork; updateProject.dateEnd = w.dateFinsinh; updateProject.numjoin = w.numJoin; var db = new userDao(); var a = db.listAllWithWorkId(id); ViewBag.dsNv = new MultiSelectList(db.listAll(), "ID", "Name", db.listAllWithWorkId(id)); return(View(updateProject)); }
//tao user public ActionResult Create(createProject acc) { if (ModelState.IsValid) { var dao = new workDao(); int id = dao.Insert(acc); if (id > 0) { return(RedirectToAction("Index", "Work")); } else { ModelState.AddModelError("", "Thêm user thành công"); } } if (acc.dsNv == null) { var db = new userDao(); ViewBag.dsNv = new MultiSelectList(db.listAll(), "ID", "Name"); } return(View()); }