19 lines
648 B
C#
19 lines
648 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
|
|
namespace MileageTraker.Web.ViewModels.Vehicle
|
|
{
|
|
public class VehicleMileageItem
|
|
{
|
|
public string VehicleId { get; set; }
|
|
public int Miles { get; set; }
|
|
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; } }
|
|
}
|
|
} |