Methodize status message handling
This commit is contained in:
@@ -71,15 +71,13 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
DataService.UpdateLog(log);
|
||||
|
||||
TempData["StatusMessage-Type"] = "alert-success";
|
||||
TempData["StatusMessage"] =
|
||||
@"You've successfully updated an entry
|
||||
SetStatusMessage(@"You've successfully updated an entry
|
||||
traveling to <strong>" + viewModel.CityName + @"</strong>
|
||||
for <strong>" + log.Purpose.Purpose + @"</strong>
|
||||
on <strong>" + viewModel.Date.ToShortDateString() + @"</strong>
|
||||
in Vehicle Id <strong>" + viewModel.VehicleId + @"</strong>
|
||||
ending in <strong>" + viewModel.EndOdometer + @"</strong>
|
||||
miles on the odometer.";
|
||||
miles on the odometer.", StatusType.Success);
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@@ -121,8 +119,7 @@ namespace MileageTraker.Web.Controllers
|
||||
DataService.AddLog(log);
|
||||
var editLink = Url.Action("EditPast", "CreateLog", new {id = log.LogId});
|
||||
|
||||
TempData["StatusMessage-Type"] = "alert-success";
|
||||
TempData["StatusMessage"] =
|
||||
SetStatusMessage(
|
||||
@"You've successfully created an entry
|
||||
traveling to <strong>" + model.CityName + @"</strong>
|
||||
for <strong>" + log.Purpose.Purpose + @"</strong>
|
||||
@@ -130,7 +127,8 @@ namespace MileageTraker.Web.Controllers
|
||||
in Vehicle Id <strong>" + model.VehicleId + @"</strong>
|
||||
ending in <strong>" + model.EndOdometer + @"</strong>
|
||||
miles on the odometer. " +
|
||||
@"<a href='" + editLink + @"' class='btn btn-mini btn-success'>Edit</a>";
|
||||
@"<a href='" + editLink + @"' class='btn btn-mini btn-success'>Edit</a>",
|
||||
StatusType.Success);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
@@ -191,13 +189,12 @@ namespace MileageTraker.Web.Controllers
|
||||
}
|
||||
catch (OutOfMemoryException)
|
||||
{
|
||||
TempData["StatusMessage"] = "Problem reading excel document - please verify that the document is in Excel 97-2003 Workbook (.xls) format";
|
||||
TempData["StatusMessage-Type"] = "alert-error";
|
||||
SetStatusMessage(
|
||||
"Problem reading excel document - please verify that the document is in Excel 97-2003 Workbook (.xls) format", StatusType.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TempData["StatusMessage"] = "Problem reading excel document: " + ex.Message;
|
||||
TempData["StatusMessage-Type"] = "alert-error";
|
||||
SetStatusMessage("Problem reading excel document: " + ex.Message, StatusType.Error);
|
||||
}
|
||||
}
|
||||
return RedirectToAction("ImportUpload");
|
||||
|
||||
Reference in New Issue
Block a user