public ActionResult CreateView() { var listUserGroup = _userGroupService.GetAll(); CreateUserViewModel createUserViewModel = new CreateUserViewModel(); createUserViewModel.UserGroups = Mapper.Map <IEnumerable <UserGroup>, IEnumerable <UGroup> >(listUserGroup); return(View(createUserViewModel)); }
// GET: Criteria/Create public ActionResult Create() { ViewBag.CertificateId = new SelectList(certificateService.GetAll(), "Id", "Name"); ViewBag.ProductionEquipmentId = new SelectList(productionEquipmentService.GetAll(), "Id", "Name"); ViewBag.SystemUserId = new SelectList(systemUserService.GetAll(), "Id", "UserName"); ViewBag.UnitId = new SelectList(unitService.GetAll(), "Id", "Name"); ViewBag.UserGroupId = new SelectList(userGroupService.GetAll(), "Id", "Name"); return(View()); }
public ActionResult Index(string companyId, string branchId) { try { if (!string.IsNullOrEmpty(companyId) && !string.IsNullOrEmpty(branchId)) { return(View(Mapper.Map <IEnumerable <UserGroupViewModel> >(_userGroupService.GetAll(companyId, branchId)))); } if (!string.IsNullOrEmpty(companyId)) { return(View(Mapper.Map <IEnumerable <UserGroupViewModel> >(_userGroupService.GetAll(companyId)))); } return(View(Mapper.Map <IEnumerable <UserGroupViewModel> >(_userGroupService.GetAll()))); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
/// <summary> /// Builds the assignment model. /// </summary> /// <param name="user">The user.</param> /// <returns></returns> public static UserGroupToUserAssignmentModel BuildAssignmentModel(User user) { IUserGroupService userGroupService = ServiceLocator.Current.GetInstance <IUserGroupService>(); var allUserGroups = userGroupService.GetAll(); return(new UserGroupToUserAssignmentModel { User = new UserViewModel().MapFrom(user), UserGroups = allUserGroups.Select(userGroup => BuildRoleAssignmentModel(user, userGroup)).ToArray() }); }
public async Task <ActionResult> GetGroups() { if (!IsAvailableOperation()) { return(BadRequest()); } var groups = await _userGroupService.GetAll(UserId, ClientId); return(Ok(groups)); }
public IActionResult GetAll() { try { return(Ok(_userGroupService.GetAll())); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(new { message = ex.Message })); } }
public HttpResponseMessage GetAllStudent(HttpRequestMessage request, int idNhom, string keyword, int page, int pageSize = 20) { return(CreateHttpResponse(request, () => { int totalRow = 0; var model = _userService.GetAllPagingByUserGroup(1); totalRow = model.Count(); var query = model.OrderByDescending(x => x.ID).Skip(page * pageSize).Take(pageSize); var resultData = from user in query.ToList() join usergroup in _userGroupService.GetAll().ToList() on user.UserGroupID equals usergroup.ID join dis in _districtService.GetAll().ToList() on user.DistrictID equals dis.ID join prov in _provinceService.GetAll().ToList() on user.ProvincesID equals prov.ID select new UserViewModel { ID = user.ID, Avatar = user.Avatar, FullName = user.FullName, Address = user.Address, NgaySinh = user.NgaySinh, Sex = user.Sex, SSN = user.SSN, Phone = user.Phone, Email = user.Email, ProvincesID = user.ProvincesID, DistrictID = user.DistrictID, UnitName = user.UnitName, Status = user.Status, UserName = user.UserName, Password = user.Password, UserGroupID = user.UserGroupID, UserGroupName = usergroup.Name, ProvincesName = prov.ProvincesName, DistrictName = dis.DistrictName, }; var paginationSet = new PaginationSet <UserViewModel>() { Items = resultData.ToList(), Page = page, TotalCount = totalRow, TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize) }; var response = request.CreateResponse(HttpStatusCode.OK, paginationSet); return response; })); }
public JsonResult getTree(string checkedId, string groupby = "org") { IEnumerable <ZTree> nodes = null; switch (groupby) { case "role": nodes = _roleService.GetAll().Select(x => new ZTree(x.Id, x.Name, "")); break; case "group": nodes = _userGroupService.GetAll().Select(x => new ZTree(x.Id, x.Name, "")); break; default: //Org nodes = _departmentService.GetAll().Select(x => new ZTree(x.Id, x.Name, x.ParentID)); break; } var tree = ZTreeHelper.ToJson(nodes, "/User?groupby=" + groupby, checkedId); return(Json(tree)); }
// GET: UserGroups public ActionResult Index() { var userGroups = Mapper.Map <IEnumerable <UserGroupViewModel> >(userGroupService.GetAll()); return(View(userGroups)); }
public ActionResult Index() { var model = _userGroupService.GetAll(); return(View(model)); }
public IActionResult GetUserGroupSample() { var model = userGroupService.GetAll <UserGroupViewModel>().FirstOrDefault(); return(View(model)); }
public List <UserGroupVM> getAll() { return(userGroupService.GetAll()); }