Add vehicle filtering for fuellog and vehicle service
This commit is contained in:
@@ -2,5 +2,18 @@ namespace MileageTraker.Web.ViewModels.VehicleService
|
||||
{
|
||||
public class VehicleServiceQueryViewModel : DateQueryViewModel
|
||||
{
|
||||
public string VehicleId { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (string.IsNullOrEmpty(VehicleId))
|
||||
return base.ToString();
|
||||
return base.ToString() + "_" + VehicleId.Replace(' ', '-');
|
||||
}
|
||||
|
||||
public override bool HasParameters()
|
||||
{
|
||||
return base.HasParameters() || !string.IsNullOrEmpty(VehicleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ namespace MileageTraker.Web.ViewModels.VehicleService
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string MonthRange { get; set; }
|
||||
public string VehicleId { get; set; }
|
||||
|
||||
public VehicleServiceResultsViewModel(
|
||||
IEnumerable<VehicleServiceViewModel> serviceItems,
|
||||
@@ -36,6 +37,7 @@ namespace MileageTraker.Web.ViewModels.VehicleService
|
||||
Year = query.Year.HasValue ? query.Year.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
Month = query.Month.HasValue ? query.Month.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
MonthRange = query.MonthRange.HasValue ? query.MonthRange.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
||||
VehicleId = query.VehicleId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user