Exemplo n.º 1
0
        public async Task <Elmah.ViewModelData.ElmahHost.IndexVM> GetIndexVM(
            [FromBody] Elmah.ViewModelData.ElmahHost.IndexVM vm)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var retval = (Elmah.AspNetMvcCoreViewModel.ElmahHost.IndexVM)scope.ServiceProvider.GetRequiredService(typeof(Elmah.AspNetMvcCoreViewModel.ElmahHost.IndexVM));
                if (vm != null)
                {
                    retval.Criteria           = vm.Criteria;
                    retval.QueryPagingSetting = vm.QueryPagingSetting;
                    retval.QueryOrderBySettingCollecionInString = vm.QueryOrderBySettingCollecionInString;
                }
                else
                {
                    retval.Criteria = new Elmah.CommonBLLEntities.ElmahHostChainedQueryCriteriaCommon();
                    //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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the wp common of build log vm.
        /// http://[host]/api/ElmahHostApi/GetIndexVM
        /// Content-Type: application/json; charset=utf-8
        /// </summary>
        /// <param name="vm">The vm.</param>
        /// <returns></returns>
        public async Task <Elmah.ViewModelData.ElmahHost.IndexVM> GetIndexVMAsync(
            Elmah.ViewModelData.ElmahHost.IndexVM vm)
        {
            const string ActionName_GetIndexVM = "GetIndexVM";
            string       url = GetHttpRequestUrl(ActionName_GetIndexVM);

            return(await Post <Elmah.ViewModelData.ElmahHost.IndexVM>(url, vm));
        }
Exemplo n.º 3
0
        public async Task TestMethod_GetIndexVM()
        {
            const string ActionName = "GetIndexVM";
            string       url        = GetHttpRequestUrl(ActionName);

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

            var response = await Post <Elmah.ViewModelData.ElmahHost.IndexVM>(url, vm);
        }
Exemplo n.º 4
0
        protected override async Task <Elmah.ViewModelData.ElmahHost.IndexVM> GetFromServer()
        {
            var vmData = new Elmah.ViewModelData.ElmahHost.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.ElmahHost.??)))
             * {
             *  vmData.QueryOrderBySettingCollection.Add(new Framework.Queries.QueryOrderBySetting { PropertyName = nameof(Elmah.DataSourceEntities.ElmahHost.??), Direction = QueryOrderBySettingCollection.First(t => t.IsSelected && t.PropertyName == nameof(Elmah.DataSourceEntities.ElmahHost.??)).Direction } );
             * }
             */

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

            return(result);
        }