Fixed issue with filters causing null ref when casting

This commit is contained in:
Ed Charbeneau 2020-05-25 12:39:10 -04:00
Родитель 7169a4a4b3
Коммит 051c083811
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -90,7 +90,7 @@
{
var state = Grid.GetState();
// clear TransactionDate filters
state.FilterDescriptors = state.FilterDescriptors.Where(f => (f as FilterDescriptor).Member != "TransactionDate").ToList();
state.FilterDescriptors = state.FilterDescriptors.Where(f => (f as FilterDescriptor)?.Member != "TransactionDate").ToList();
// assign new TransactionDate filters
state.FilterDescriptors.Add(StartFilter());
state.FilterDescriptors.Add(EndFilter());

Просмотреть файл

@ -1,6 +1,7 @@
using BlazingCoffee.Shared;
using BlazingCoffee.Shared.Models;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -24,7 +25,7 @@ namespace BlazingCoffee.Server.Controllers
[HttpPost]
public async Task<ActionResult<DataEnvelope<Sale>>> GetSales([FromBody]DataSourceRequest request)
{
var result = await _context.Sales.ToDataSourceResultAsync(request);
DataSourceResult result = await _context.Sales.ToDataSourceResultAsync(request);
var data = new DataEnvelope<Sale>
{
CurrentPageData = result.Data.OfType<Sale>().ToList(),