A couple of fixes

This commit is contained in:
2015-09-25 12:52:21 -04:00
parent b420193c3d
commit a6ea6df177
5 changed files with 31 additions and 4 deletions
+24
View File
@@ -38,6 +38,30 @@ namespace MileageTraker.Web.Controllers
return View(viewModel);
}
[ActionLog]
public ActionResult Export(FuelLogQueryViewModel query)
{
var validLogYearMonths = DataService.GetValidFuelLogMonths();
// default parameter processing
if (!query.HasParameters())
{
query.FiscalYear = validLogYearMonths.First().Year;
query.Month = validLogYearMonths.First().Month;
}
var fuelLogs = DataService.GetFuelLogs();
var filteredLogs =
from fl in DataService.FilterFuelLogs(fuelLogs, query).ToList()
orderby fl.Date ascending
select new FuelLogIndexViewModel(fl);
var name = string.Format("FuelLogs_{0}", query);
var export = ExcelWriter<FuelLogIndexViewModel>.WriteXls(filteredLogs, name, name);
return File(export, "application/ms-excel", name + ".xls");
}
public ViewResult Details(int id)
{
var fuelLog = DataService.GetFuelLog(id);