A couple of fixes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user