Add vehicle filtering for fuellog and vehicle service

This commit is contained in:
2015-10-26 10:09:12 -04:00
parent ad0b04695d
commit 9177a8dbb3
10 changed files with 63 additions and 9 deletions
+7 -1
View File
@@ -663,6 +663,10 @@ namespace MileageTraker.Web.DAL
{
fuelLogs = fuelLogs.Where(l => l.Log == null);
}
if (!string.IsNullOrEmpty(query.TagNumber))
{
fuelLogs = fuelLogs.Where(l => l.TagNumber == query.TagNumber);
}
return fuelLogs;
}
@@ -842,8 +846,10 @@ namespace MileageTraker.Web.DAL
var start = new DateTime(query.Year.Value, query.Month.Value, 1);
var monthRange = query.MonthRange.HasValue ? query.MonthRange.Value : 1;
var end = start.AddMonths(monthRange);
vehicleServices = vehicleServices.Where(l => l.InvoiceDate >= start && l.InvoiceDate < end);
vehicleServices = vehicleServices.Where(vs => vs.InvoiceDate >= start && vs.InvoiceDate < end);
}
if (!string.IsNullOrEmpty(query.VehicleId))
vehicleServices = vehicleServices.Where(vs => vs.Vehicle.VehicleId == query.VehicleId);
return vehicleServices;
}