示例#1
0
        public async Task <PushNotificationSearchModel> PreparePushNotificationSearchModel(PushNotificationSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            var stores = await _storeService.GetStores();

            searchModel.AvailableStores = stores.Select(store => new SelectListItem
            {
                Text  = store.P_BranchNo.ToString() + " - " + store.P_Name,
                Value = store.P_BranchNo.ToString()
            }).ToList();

            SelectListItem initialItem = new SelectListItem()
            {
                Text  = "ALL",
                Value = "-99"
            };

            searchModel.AvailableStores.Insert(0, initialItem);

            var notificationCategories = await _pushNotificationService.GetNotificationCategoriesAsync();

            //TODO
            //if (notificationCategories != null && notificationCategories.Count > 0)
            //{
            //    _pushNotificationService.
            //}
            //else
            //{
            //}

            searchModel.AvailableNotificationCategory = notificationCategories.Select(notificationCategory => new SelectListItem
            {
                Text  = notificationCategory.Name,
                Value = notificationCategory.Id.ToString()
            }).ToList();

            return(await Task.FromResult(searchModel));
        }