Refactor Miles into log output
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using MileageTraker.Web.Models;
|
||||
|
||||
@@ -11,20 +12,31 @@ namespace MileageTraker.Web.ViewModels.Log
|
||||
|
||||
public int LogId { get; set; }
|
||||
|
||||
[Display(Name = "Vehicle ID")]
|
||||
public string VehicleId { get; set; }
|
||||
|
||||
[Display(Name = "End Odometer")]
|
||||
public int EndOdometer { get; set; }
|
||||
|
||||
public int Miles { get; set; }
|
||||
|
||||
[Display(Name = "Type")]
|
||||
public MileageLogTypeWrapper LogType { get; set; }
|
||||
|
||||
[Display(Name = "City Name")]
|
||||
public string CityName { get; set; }
|
||||
|
||||
public virtual Models.User User { get; set; }
|
||||
[Display(Name = "Driver Name")]
|
||||
public string UserFullName { get; set; }
|
||||
|
||||
[Display(Name = "Gas Purchased")]
|
||||
[DisplayFormat(DataFormatString = "{0:0.000}", ApplyFormatInEditMode = true)]
|
||||
public double GasPurchased { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
[Display(Name = "Time Created")]
|
||||
[DisplayFormat(DataFormatString = @"{0:MM/dd/yyyy h:mm tt}")]
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
static LogIndexViewModel()
|
||||
@@ -39,6 +51,7 @@ namespace MileageTraker.Web.ViewModels.Log
|
||||
{
|
||||
PreviousLogId = previousLog.LogId;
|
||||
PreviousLogEndOdometer = previousLog.EndOdometer;
|
||||
Miles = EndOdometer - previousLog.EndOdometer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user