Files
MileageTraker/Web/ViewModels/Vehicle/VehicleMileageItem.cs
T
2013-02-17 14:30:25 -05:00

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; } }
}
}