public ActionResult Index(GridCommand command, UserModel model)
        {
            if (!PermissionService.Authorize(PermissionProvider.ManageUsers))
                return AccessDeniedView();

            int totalRecords = 0;
            var query = _unitOfWork.UserRepository.GetAsQuerable(x => !x.Deleted).OrderByDescending(x => x.CreatedOn);

            var users = query.ApplyGridCommandsWithPaging(command, out totalRecords);

            var modelList = new List<UserModel>();

            foreach (var user in users)
            {
                var newUser = new UserModel
                {
                    Id = user.Id,
                    FirstName = user.FirstName,
                    LastName = user.LastName,
                    UserName = user.Username,
                    Email = user.Email,
                    Role = user.Role.Name,
                    Active = user.Active
                };
                var temp = _unitOfWork.UserRepository.GetById(user.CreatedByUserId);
                if (temp != null)
                {
                    newUser.CreatedBy = temp.FirstName + " " + temp.LastName;
                }
                newUser.CreatedOn = user.CreatedOn.ToString("MM/dd/yyyy");
                modelList.Add(newUser);
            }

            var gridModel = new GridModel<UserModel>
            {
                Data = modelList,
                Total = totalRecords
            };

            return View(gridModel);
        }
        public ActionResult Index(GridCommand command, UserModel model)
        {
            if (!PermissionService.Authorize(PermissionProvider.ManageRoles))
                return AccessDeniedView();

            int totalRecords = 0;
            var query = _unitOfWork.RoleRepository.GetAsQuerable(x => !x.Deleted).OrderByDescending(x => x.CreatedOn);
            var roles = query.ApplyGridCommandsWithPaging(command, out totalRecords);

            List<RoleModel> modelList = new List<RoleModel>();

            foreach (var role in roles)
            {
                RoleModel newRole = new RoleModel();
                newRole.Id = role.Id;
                newRole.Name = role.Name;
                newRole.Description = role.Description;
                newRole.Active = role.Active;
                newRole.CreatedOn = role.CreatedOn.ToString("MM/dd/yyyy");

                var temp = _unitOfWork.UserRepository.GetById(role.CreatedByUserId);
                if (temp != null)
                {
                    newRole.CreatedBy = temp.FirstName + " " + temp.LastName;
                }

                modelList.Add(newRole);
            }

            var gridModel = new GridModel<RoleModel>
            {
                Data = modelList,
                Total = totalRecords
            };
            return View(gridModel);
        }
        public ActionResult Index(GridCommand command, UserModel model)
        {
            if (!PermissionService.Authorize(PermissionProvider.ManageSettings))
                return AccessDeniedView();

            int totalRecords = 0;
            var query = _unitOfWork.SettingRepository.GetAsQuerable(x => !x.Deleted).OrderByDescending(x => x.CreatedOn);
            var settings = query.ApplyGridCommandsWithPaging(command, out totalRecords);

            var listModel = new List<SettingModel>();

            foreach (var topic in settings)
            {
                var setting = new SettingModel
                {
                    Id = topic.Id,
                    SettingName = topic.SettingName,
                    Value = topic.Value,
                    Description = topic.Description
                };
                var user1 = _unitOfWork.UserRepository.GetById(topic.CreatedByUserId);
                if (user1 != null)
                {
                    setting.CreatedBy = user1.FirstName;
                }
                listModel.Add(setting);
            }

            var gridModel = new GridModel<SettingModel>
            {
                Data = listModel,
                Total = totalRecords
            };

            return View(gridModel);
        }