public ActionResult GetUserManagerInfo(SearchData VSearchData) { UserManagerModel model = new UserManagerModel(); model.GetUser(VSearchData); return(Json(new { ListUsers = model.ListUsers, ListType = model.ListType })); }
public ActionResult EditUserType(int id, string type, string username) { UserManagerModel model = new UserManagerModel(); model.EditUserType(id, type, username); return(Json(new { ListUsers = model.ListUsers, ListType = model.ListType })); }
public ActionResult Module() { var segment = Request.Url.Segments; var pagenumber = getPageId(segment); var mid = (int)ControllerContext.RouteData.Values["moduleId"]; var urlCreate = Path.ApplicationRoot + "/DesktopModules/CoreModules/Users/UsersManage.aspx?pageId=" + pagenumber + "&mID=" + mid; var model = new UserManagerModel { UserEmail = urlCreate }; return(View(model)); }
public IActionResult Create([FromBody] UserManagerModel userModel) { try { string email = Request.Headers["Email"]; string password = Request.Headers["Password"]; if (String.IsNullOrEmpty(email) || String.IsNullOrEmpty(password)) { return(BadRequest(_itemHelper.response(false, 500, "User can not authenticate please check email and password"))); } UserManager user = _userManagerService.AuthenticateUser(email, password); if (user == null) { return(BadRequest(_itemHelper.response(false, 500, "User model is empty"))); } CommonEnum.UserRoleType roletype = (CommonEnum.UserRoleType)Enum.Parse(typeof(CommonEnum.UserRoleType), user.RoleManager.Name); if (roletype != CommonEnum.UserRoleType.admin) { return(BadRequest(_itemHelper.response(false, 500, "You dont have right's to update entries"))); } if (userModel == null) { return(BadRequest("User object is null")); } if (!ModelState.IsValid) { return(BadRequest("Invalid User model object")); } UserManager userCreate = new UserManager { Email = userModel.Email, Password = userModel.Password, RoleId = Convert.ToInt32(userModel.RoleType) }; _userManagerService.InsertUser(userCreate); return(StatusCode(200, "User Created")); } catch (Exception ex) { return(StatusCode(500, "Internal server error")); } }
public JsonResult GridUser(int page, int rows, string search, string sidx, string sord) { var data = new List <UserManagerModel>(); var tbl = new DynamicModel("ConnectionString", "aspnet_CustomProfile", "UserId"); dynamic iduser = tbl.Query("SELECT m.ApplicationId, m.UserId, m.Email, cp.Name " + "FROM aspnet_Membership as m LEFT JOIN aspnet_CustomProfile as cp " + "ON m.UserId = cp.UserId " + "inner join aspnet_Applications as a " + "on a.ApplicationName = @0 and a.ApplicationId = m.ApplicationId " + "order by cp.Name", Portal.UniqueID); var table = new DynamicModel("ConnectionString", "aspnet_Roles", "RoleId"); dynamic roles = table.Query("SELECT r.RoleName, ur.UserId " + "FROM aspnet_Roles r, aspnet_UsersInRoles ur " + "WHERE r.RoleId = ur.RoleId"); var iRoles = (IEnumerable <dynamic>)roles; var i = 1; foreach (var user in iduser) { var m = new UserManagerModel(); m.id = i; m.UserId = user.UserId; m.UserName = user.Name; m.UserEmail = user.Email; var userrolid = Guid.Parse(user.UserId.ToString()); try { var roleName = iRoles.Where(r => r.UserId == userrolid); m.UserRol = roleName.Single().RoleName; } catch { m.UserRol = ""; } m.Edit = Builddir(m.UserEmail); data.Add(m); i++; } if (!string.IsNullOrEmpty(search)) { return(Search(search, page, rows, data)); } var result = GetRowsFromList(data.AsQueryable(), rows, page); return(result); }
public UserManagerModel getUserView(int page, string searchName) { var pageSize = 6; var temp = _unitOfWork.Users.GetAll(); var model = new UserManagerModel(); // search if (searchName != null && searchName.Trim() != "") { searchName = searchName.Trim().ToLower(); ViewData["searchName"] = searchName; temp = temp.Where(a => a.Name.ToLower().IndexOf(searchName) != -1).ToList(); } var users = PaginatedList <User> .Create(temp, page, pageSize); model.Users = users; return(model); }
public ActionResult UserManager() { UserManagerModel model = new UserManagerModel(); return(View(model)); }