// // GET: /Users/Edit/5 public ActionResult Edit(int id) { UserBAL _userBAL = new UserBAL(); User _user = _userBAL.GetUserById(id); var model = new UserModel(); model.Id = _user.Id; model.UserName = _user.UserName; model.Email = _user.Email; model.Password = _user.Password; model.IsActive = true; model.LawFirmId = _user.LawFirmId; //model.PersonId = _user.PersonId; model.UpdatedDate = DateTime.Now.ToUniversalTime(); model.IsDeleted = false; //model.RewardPoints = _user.RewardPoints; model.RoleId = _user.RoleId; model.CreatedDate = _user.CreatedDate; UserRoleBAL _userRoleBAL = new UserRoleBAL(); List <UserRole> userRole = _userRoleBAL.GetAllUserRoles(); foreach (var i in userRole) { model.Roles.Add(new SelectListItem { Text = i.RoleName, Value = i.Id.ToString() }); } return(View(model)); }
// // GET: /UserRole/ public ActionResult Index() { UserRoleBAL _userRole = new UserRoleBAL(); List <UserRole> user = _userRole.GetAllUserRoles(); List <UserRoleModel> _userRoleModel = new List <UserRoleModel>(); foreach (var u in user) { var model = new UserRoleModel(); model.RoleId = u.Id; model.RoleName = u.RoleName; model.IsActive = u.IsActive; model.CreatedBy = "Admin"; model.CreatedDate = DateTime.Now.ToUniversalTime(); _userRoleModel.Add(model); } return(View(_userRoleModel)); }
// // GET: /Users/Create public ActionResult Create() { var model = new UserModel(); UserRoleBAL _userRoleBAL = new UserRoleBAL(); List <UserRole> userRole = _userRoleBAL.GetAllUserRoles(); foreach (var i in userRole) { model.Roles.Add(new SelectListItem { Text = i.RoleName, Value = i.Id.ToString() }); } //var user = new QuestionModel(); return(View()); }