Merge
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MileageTraker.Web.ViewModels.Vehicle;
|
||||
@@ -8,10 +7,21 @@ namespace MileageTraker.Web.ViewModels
|
||||
public class DriverMileageItem
|
||||
{
|
||||
public string DriverName { get; set; }
|
||||
public int Miles { get; set; }
|
||||
public double GasPurchased { get; set; }
|
||||
public IEnumerable<Tuple<Models.Log, Models.Log>> LogPairs { get; set; }
|
||||
public IEnumerable<VehicleMileageItem> VehicleMileageItems { get; set; }
|
||||
public int TripCount { get { return LogPairs.Count(); } }
|
||||
|
||||
public int Miles
|
||||
{
|
||||
get { return VehicleMileageItems.Sum(i => i.Miles); }
|
||||
}
|
||||
|
||||
public double GasPurchased
|
||||
{
|
||||
get { return VehicleMileageItems.Sum(i => i.GasPurchased); }
|
||||
}
|
||||
|
||||
public int TripCount
|
||||
{
|
||||
get { return VehicleMileageItems.Sum(i => i.LogPairs.Count()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ namespace MileageTraker.Web.ViewModels
|
||||
public LogQueryViewModel Query { get; set; }
|
||||
|
||||
public int TotalMiles { get { return Items.Sum(i => i.Miles); } }
|
||||
public int TotalTrips { get { return Items.Sum(i => i.TripCount); } }
|
||||
public double TotalGasPurchased { get { return Items.Sum(i => i.GasPurchased); } }
|
||||
|
||||
public DriverMileageViewModel(IEnumerable<DriverMileageItem> items, LogQueryViewModel query)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace MileageTraker.Web.ViewModels.Vehicle
|
||||
{
|
||||
@@ -10,5 +12,8 @@ namespace MileageTraker.Web.ViewModels.Vehicle
|
||||
public double GasPurchased { get; set; }
|
||||
public string Prog { get; set; }
|
||||
public IEnumerable<Tuple<Models.Log, Models.Log>> LogPairs { get; set; }
|
||||
public int TripCount { get { return LogPairs.Count(); } }
|
||||
[DisplayFormat(DataFormatString = "{0:0.000}")]
|
||||
public double MilesPerGallon { get { return GasPurchased == 0 || Miles == 0 ? 0 : Miles / GasPurchased; } }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user