예제 #1
0
        public async Task <Elmah.ViewModelData.ElmahType.IndexVM> GetIndexVM(
            [FromBody] Elmah.ViewModelData.ElmahType.IndexVM vm)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var retval = (Elmah.AspNetMvcCoreViewModel.ElmahType.IndexVM)scope.ServiceProvider.GetRequiredService(typeof(Elmah.AspNetMvcCoreViewModel.ElmahType.IndexVM));
                if (vm != null)
                {
                    retval.Criteria           = vm.Criteria;
                    retval.QueryPagingSetting = vm.QueryPagingSetting;
                    retval.QueryOrderBySettingCollecionInString = vm.QueryOrderBySettingCollecionInString;
                }
                else
                {
                    retval.Criteria = new Elmah.CommonBLLEntities.ElmahTypeChainedQueryCriteriaCommon();
                    //retval.QueryOrderBySettingCollecionInString = Elmah.ViewModelData.OrderByLists.IndexVM_GetDefaultListOfQueryOrderBySettingCollecionInString();
                }
                if (retval.QueryPagingSetting == null)
                {
                    retval.QueryPagingSetting = Framework.Queries.QueryPagingSetting.GetDefault();
                }

                retval.SetServiceProvider(this._serviceProvider);
                await retval.LoadData(false);

                return(retval);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the wp common of build log vm.
        /// http://[host]/api/ElmahTypeApi/GetIndexVM
        /// Content-Type: application/json; charset=utf-8
        /// </summary>
        /// <param name="vm">The vm.</param>
        /// <returns></returns>
        public async Task <Elmah.ViewModelData.ElmahType.IndexVM> GetIndexVMAsync(
            Elmah.ViewModelData.ElmahType.IndexVM vm)
        {
            const string ActionName_GetIndexVM = "GetIndexVM";
            string       url = GetHttpRequestUrl(ActionName_GetIndexVM);

            return(await Post <Elmah.ViewModelData.ElmahType.IndexVM>(url, vm));
        }
예제 #3
0
        public async Task TestMethod_GetIndexVM()
        {
            const string ActionName = "GetIndexVM";
            string       url        = GetHttpRequestUrl(ActionName);

            var vm = new Elmah.ViewModelData.ElmahType.IndexVM();

            var response = await Post <Elmah.ViewModelData.ElmahType.IndexVM>(url, vm);
        }
예제 #4
0
        protected override async Task <Elmah.ViewModelData.ElmahType.IndexVM> GetFromServer()
        {
            var vmData = new Elmah.ViewModelData.ElmahType.IndexVM
            {
                Criteria                      = this.Criteria,
                QueryPagingSetting            = CachingOption == Framework.Xaml.CachingOptions.NoCaching ? this.QueryPagingSetting : new Framework.Queries.QueryPagingSetting(1, 10000),
                QueryOrderBySettingCollection = new Framework.Queries.QueryOrderBySettingCollection(QueryOrderBySettingCollection.Where(t => t.IsSelected)),
            };

            vmData.Criteria.CanQueryWhenNoQuery = true;

            /*
             * // Add extra QueryOrderBySetting, eg CategoryName -> Name of this class.
             * if (QueryOrderBySettingCollection.Any(t => t.IsSelected && t.PropertyName == nameof(Elmah.DataSourceEntities.ElmahType.??)))
             * {
             *  vmData.QueryOrderBySettingCollection.Add(new Framework.Queries.QueryOrderBySetting { PropertyName = nameof(Elmah.DataSourceEntities.ElmahType.??), Direction = QueryOrderBySettingCollection.First(t => t.IsSelected && t.PropertyName == nameof(Elmah.DataSourceEntities.ElmahType.??)).Direction } );
             * }
             */

            var client = WebApiClientFactory.CreateElmahTypeApiClient();
            var result = await client.GetIndexVMAsync(vmData);

            return(result);
        }