31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
|
|
namespace MileageTraker.Web.ViewModels.FuelLog
|
|
{
|
|
public class FuelLogResultsViewModel
|
|
{
|
|
public IEnumerable<FuelLogIndexViewModel> FuelLogs { get; set; }
|
|
public Dictionary<string, List<string>> AvailableYearMonths { get; set; }
|
|
public IEnumerable<string> SelectedYearMonths{get
|
|
{
|
|
if (!string.IsNullOrEmpty(FiscalYear))
|
|
return AvailableYearMonths[FiscalYear];
|
|
return new List<string>();
|
|
}}
|
|
|
|
// filter parameters
|
|
public string FiscalYear { get; set; }
|
|
public string Month { get; set; }
|
|
public bool Unmatched { get; set; }
|
|
|
|
public FuelLogResultsViewModel(IEnumerable<FuelLogIndexViewModel> fuelLogs, FuelLogQueryViewModel query, Dictionary<string, List<string>> availableYearMonths)
|
|
{
|
|
FuelLogs = fuelLogs;
|
|
AvailableYearMonths = availableYearMonths;
|
|
FiscalYear = query.FiscalYear.HasValue ? query.FiscalYear.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
|
Month = query.Month.HasValue ? query.Month.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
|
Unmatched = query.Unmatched;
|
|
}
|
|
}
|
|
} |