Пример #1
0
        public EditUserModel CreateEditUserModel(string userId)
        {
            var permissionFactory = new PermissionFactory();

            var userDetails = CreateUserDetailsModel(new UserService().GetUserById(userId));
            var locations = new LocationService().GetAllLocations().ToList();
            var permissions = new PermissionService().GetAllPermissions().Select(permissionFactory.CreatePermissionModel).ToList();

            return new EditUserModel()
            {
                Locations = locations,
                Permissions = permissions,
                UserDetails = userDetails
            };
        }
Пример #2
0
        public ActionResult CreateUser()
        {
            var permissionFactory = new PermissionFactory();

            var locations = new LocationService().GetAllLocations().ToList();
            var permissions = new PermissionService().GetAllPermissions().Select(permissionFactory.CreatePermissionModel).ToList();


            var editUserModel = new CreateUserModel()
            {
                AllPermissions =  permissions,
                AllLocations = locations
            };

            return View(editUserModel);
        }
Пример #3
0
        private UserDetailsModel CreateUserDetailsModel(UserDetailsDTO userDetaislDTO)
        {
            var permissionFactory = new PermissionFactory();

            return new UserDetailsModel()
            {
                UserId = userDetaislDTO.UserId,
                UserName = userDetaislDTO.UserName,
                BU = userDetaislDTO.BU,
                GPN = userDetaislDTO.GPN,
                LocationId = userDetaislDTO.LocationId,
                Mail = userDetaislDTO.Mail,
                SMU = userDetaislDTO.SMU,
                Permissions = userDetaislDTO.Permission.Select(permissionFactory.CreatePermissionLocationModel).ToList()
            };
        }
Пример #4
0
 public UserDetailsListModel CreateUserDetailsListModel(string userNameFilter, int pageIndex, int pageSize)
 {
 
     var permissionFactory = new PermissionFactory();
 
     var userDetailsModels = new UserService().GetUsersByName(userNameFilter, pageIndex, pageSize).Select(CreateUserDetailsModel).ToList();
 
     var locations = new LocationService().GetAllLocations();
 
     var permissions = new PermissionService().GetAllPermissions().Select(permissionFactory.CreatePermissionModel).ToList();
 
     return new UserDetailsListModel()
     {
         Locations = locations,
         Permission = permissions,
         Users = new Common.PageableList<UserDetailsModel>(userDetailsModels, pageSize, pageIndex)
     };
 }