Fuel Log Match

This commit is contained in:
2015-09-22 21:11:47 -04:00
parent 27375bbb65
commit 829d84d73e
18 changed files with 748 additions and 233 deletions
+15 -2
View File
@@ -45,7 +45,6 @@ namespace MileageTraker.Web.Controllers
orderby log.Created descending
select log).ToList();
var viewModel = new LogResultsViewModel(filteredLogs, query, CustomExtensions.YearMonthList(validLogYearMonths));
Session.Add("LogPage", Request.Url.PathAndQuery);
@@ -162,7 +161,21 @@ namespace MileageTraker.Web.Controllers
DataService.AddLog(log);
TempData["StatusMessage"] = "Log created";
return RedirectToAction("Index");
if (TempData.ContainsKey("FuelLogId"))
{
// update fuel log
var fuelLogId = (int)TempData["FuelLogId"];
var fuelLog = DataService.GetFuelLog(fuelLogId);
fuelLog.Log = log;
DataService.UpdateFuelLog(fuelLog);
// return to the fuel log match page
TempData["StatusMessage"] = "Log created and matched to the fuel log";
return RedirectToAction("Match", "FuelLog", new {id = fuelLogId});
}
return RedirectToAction("Index");
}
viewModel.Purpose.Available = GetPurposeTypesSelectList();