Match count badges

This commit is contained in:
2015-10-13 20:39:51 -04:00
parent 49c55ffba6
commit 78e8924bfa
4 changed files with 59 additions and 17 deletions
+15 -1
View File
@@ -60,7 +60,21 @@ namespace MileageTraker.Web.Controllers
var vm = new FuelLogViewModel(fuelLog) { VehicleId = DataService.GetVehicleIdByTag(fuelLog.TagNumber) };
return View(vm);
}
public JsonResult AvailableMatchCount(int id)
{
var fuelLog = DataService.GetFuelLog(id);
var fuelLogViewModel = new FuelLogViewModel(fuelLog) {VehicleId = DataService.GetVehicleIdByTag(fuelLog.TagNumber)};
var logs = from l in DataService.GetPossibleMatchingLogs(fuelLog).ToList()
where l != fuelLog.Log
let v = l.Vehicle
let vm = new LogMatchViewModel(l, v, fuelLogViewModel)
select vm;
return Json(logs.Count(), JsonRequestBehavior.AllowGet);
}
public ViewResult Match(int id)
{
var fuelLog = DataService.GetFuelLog(id);