Ejemplo n.º 1
0
        public async Task <Elmah.ViewModelData.ELMAH_Error.IndexVM> GetIndexVM(
            [FromBody] Elmah.ViewModelData.ELMAH_Error.IndexVM vm)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var retval = (Elmah.AspNetMvcCoreViewModel.ELMAH_Error.IndexVM)scope.ServiceProvider.GetRequiredService(typeof(Elmah.AspNetMvcCoreViewModel.ELMAH_Error.IndexVM));

                if (vm != null)
                {
                    retval.Criteria           = vm.Criteria;
                    retval.QueryPagingSetting = vm.QueryPagingSetting;
                    retval.QueryOrderBySettingCollecionInString = vm.QueryOrderBySettingCollecionInString;
                }
                else
                {
                    retval.Criteria = new Elmah.CommonBLLEntities.ELMAH_ErrorChainedQueryCriteriaCommon();
                    //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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the wp common of build log vm.
        /// http://[host]/api/ELMAH_ErrorApi/GetIndexVM
        /// Content-Type: application/json; charset=utf-8
        /// </summary>
        /// <param name="vm">The vm.</param>
        /// <returns></returns>
        public async Task <Elmah.ViewModelData.ELMAH_Error.IndexVM> GetIndexVMAsync(
            Elmah.ViewModelData.ELMAH_Error.IndexVM vm)
        {
            const string ActionName_GetIndexVM = "GetIndexVM";
            string       url = GetHttpRequestUrl(ActionName_GetIndexVM);

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

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

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

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

            return(result);
        }