public ActionResult Details(int id) { UserAndRolesService.RolesClient rl = new UserAndRolesService.RolesClient(); var RoleList = rl.GetAllRoleList().Select(s => new SelectListItem { Text = s.RName, Value = s.RId.ToString() }); ViewBag.RoleList = RoleList; UserAndRolesService.UserClient usr = new UserAndRolesService.UserClient(); var data = usr.GetById(id); var usrDetail = data.Select(s => new UserDetail { Id = s.ID, Name = s.Name, Password = s.Password, Surname = s.Surname, UserRoles = s.URoles.Select(c => new Role { Id = c.RId, RoleDesciription = c.RDescription, RoleName = c.RName }).ToList() }).First(); return(View(usrDetail)); }
public ActionResult Edit(int id) { UserAndRolesService.RolesClient role = new UserAndRolesService.RolesClient(); var roleModel = role.GetRoleById(id).Select(S => new Role { Id = S.RId, RoleDesciription = S.RDescription, RoleName = S.RName }).First(); return(View(roleModel)); }
// GET: Roles public ActionResult Index() { UserAndRolesService.RolesClient role = new UserAndRolesService.RolesClient(); var data = role.GetAllRoleList().Select(s => new Role { Id = s.RId, RoleDesciription = s.RDescription, RoleName = s.RName }); return(View(data)); }
public ActionResult UserAndRoles() { UserAndRolesService.RolesClient usr = new UserAndRolesService.RolesClient(); var data = usr.UserAndRolesList().Select(S => new UserAndRoles { FullName = S.FullName, Id = S.URId, RoleName = S.RoleName }).ToList(); return(View(data)); }
public ActionResult Edit(Role model) { UserAndRolesService.RolesClient role = new UserAndRolesService.RolesClient(); var data = new UserAndRolesService.RolesModel { RDescription = model.RoleDesciription, RId = model.Id, RName = model.RoleName }; role.UpdateRole(data); return(RedirectToAction("Index")); }
public ActionResult Details(int id) { UserAndRolesService.RolesClient role = new UserAndRolesService.RolesClient(); var data = role.GetRoleById(id).Select(s => new RoleDetail { Id = s.RId, RoleName = s.RName, RoleDesciription = s.RDescription, RoleUsers = s.Users.Select(c => new User { Id = c.ID, Name = c.Name, Surname = c.Surname, Password = c.Password }).ToList() }).First(); return(View(data)); }
public ActionResult Delete(int id) { UserAndRolesService.RolesClient role = new UserAndRolesService.RolesClient(); TempData["Message"] = role.DeleteRole(id); return(RedirectToAction("Index")); }