public ActionResult Create() { ser = new UserManagementRepository(); var model = new Hotels.ClientDataModel.MetaData.Hotel.UserManagementModel.CreateAspUser { // AgentList = _agentPorvider.getAllAgentList() }; ViewData["RolesList"] = ser.GetAllRolesList(); return(View(model)); }
public ActionResult Create(Hotels.ClientDataModel.MetaData.Hotel.UserManagementModel.CreateAspUser obj, FormCollection fc) { // UserManagementProvider sr = new UserManagementProvider(); if (obj.Password != obj.ConfirmPassword) { TempData["ErrorMessage"] = "Registration failed! Your passwords must match, please re-enter and try again"; return(RedirectToAction("Create")); } // sr.CreateUser(obj); Guid userid = ser.ListAllUser().Last().UserId; ///////Get Roles information///////////// //List<Guid> RoleIds = new List<Guid>(); List <aspnet_Roles> vu = ser.GetAllRolesList(); // RoleIds = new List<Guid>(); foreach (aspnet_Roles u in vu) { if (fc["Chk_" + u.RoleId].ToString() != "false") { //string cCid = fc["Chk_" + u.RoleId].ToString(); //int i = cCid.IndexOf(","); //Guid j = Guid.Parse(cCid.Substring(0, i)); //RoleIds.Add(j); Roles.AddUserToRole(obj.UserName, u.RoleName); } } //ser.AddRoleforParticularUser(RoleIds, userid); //////////////End of Role///////////// //var model = new AirLines.DataModel.ModelMetaData.AirLine.UserManagementModel.CreateAspUser //{ // AgentList = _agentPorvider.getAllAgentList() //}; //return View(model); return(RedirectToAction("Index")); }