public void SetViewBag(string userGroupID = null) { var dao = new UserGroupDao(); if (userGroupID != null) { var selectedId = dao.ViewDetail(userGroupID).ID; ViewBag.GroupID = new SelectList(dao.ListAll(), "ID", "Name", selectedId); } else { var selectedId = dao.ViewDetail("MEMBER").ID; ViewBag.GroupID = new SelectList(dao.ListAll(), "ID", "Name", selectedId); } }
public ActionResult Edit(int id) { ViewBag.Role = _userGrDao.ListAllRole(); string _credential = null; foreach (var credential in _userGrDao.GetCredentialByUserGroupID(id)) { _credential += credential.RoleID + ","; } ViewBag.Credentail = _credential; var user = _userGrDao.ViewDetail(id); var res = Mapper.Map <UserGroup, UserGroupViewModel>(user); return(View(res)); }