29 lines
970 B
C#
29 lines
970 B
C#
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
|
|
namespace MileageTraker.Web.ViewModels.FuelLog
|
|
{
|
|
public class ResultsViewModel
|
|
{
|
|
public IEnumerable<Models.FuelLog> Logs { get; set; }
|
|
public Dictionary<string, List<string>> AvailableYearMonths { get; set; }
|
|
public IEnumerable<string> SelectedYearMonths{get
|
|
{
|
|
if (!string.IsNullOrEmpty(Year))
|
|
return AvailableYearMonths[Year];
|
|
return new List<string>();
|
|
}}
|
|
|
|
// filter parameters
|
|
public string Year { get; set; }
|
|
public string Month { get; set; }
|
|
|
|
public ResultsViewModel(IEnumerable<Models.FuelLog> logs, FuelLogQueryViewModel query, Dictionary<string, List<string>> availableYearMonths)
|
|
{
|
|
Logs = logs;
|
|
AvailableYearMonths = availableYearMonths;
|
|
Year = query.Year.HasValue ? query.Year.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
|
Month = query.Month.HasValue ? query.Month.Value.ToString(CultureInfo.InvariantCulture) : string.Empty;
|
|
}
|
|
}
|
|
} |