示例#1
0
        public ActionResult Index(ProfileBoxSearchModel search, int page = 1, int pageSize = 5, GridSortOptions sort = null)
        {
            var model = new ProfileBoxsModel();
            //model.ProfileBox = new ProfileBoxInfomationModel
            //{
            //    Name = DateTime.Now.ToString("ddMMyyyy_HH") + "_" + _workContext.User.UserName,
            //    UserName = _workContext.User.UserName
            //};

            Dictionary <string, string> profileTypes = _profileTypeService.GetAllTypes();

            ViewBag.ProfileType = WebUtility.ConvertDictionaryToSelectList(profileTypes, true);

            Dictionary <string, string> warehouses = _warehouseService.GetAllWarehouses();

            ViewBag.Warehouses = WebUtility.ConvertDictionaryToSelectList(warehouses, true);


            Dictionary <string, string> users = _userService.GetAllUsers();

            ViewBag.Users = WebUtility.ConvertDictionaryToSelectList(users, true);



            ViewBag.StatusList = WebUtility.ConvertEnumToSelectList <ABO.Core.ProfileBoxStatus>(true);
            model.SearchModel  = search;

            var data = _profileBoxService.Search(page, pageSize, search.ToCriteria <ProfileBoxSearchModel, ProfileBoxSearchCriteria>());

            model.Data = data.Select(x => x.ToModel <ProfileBoxGridModel>()).ToList();

            ViewBag.ShowAddButton = _workContext.User.WarehouseId;

            model.Pager = data.ToMvcPaging(model.Data);

            return(View(model));
        }
示例#2
0
        //
        // GET: /ProfileType/

        public ActionResult Index(GridSortOptions sort = null)
        {
            //if (!_permissionService.Authorize(UserPermission.ManageProfileType))
            //    return PageForbidden();

            if (sort == null || string.IsNullOrEmpty(sort.Column))
            {
                sort = new GridSortOptions()
                {
                    Column = "Name", Direction = SortDirection.Ascending
                }
            }
            ;
            ViewBag.Sort = sort;

            var model        = new ProfileTypeIndexModel();
            var profileTypes = _profileTypeService.GetAllTypes(sort.Column, WebUtility.GetSortDir(sort));

            model.ProfileTypes = profileTypes.Select(x => x.ToModel <ProfileTypeModel>()).ToList();

            return(View(model));
        }