BenefitsAllocationUpload.Controllers.ReportsController.Display C# (CSharp) Method

Display() public method

public Display ( string id ) : System.Web.Mvc.ActionResult
id string
return System.Web.Mvc.ActionResult
        public ActionResult Display(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                TempData["Message"] = "Unable to display file.  No file was selected. Please select a file and try again.";
                return RedirectToAction("Index");
            }

            var file = GetNamedFile(id);

            var engine = new FileHelperEngine<FeederSystemFixedLengthRecord>();

            var streamReader = new StreamReader(file.FilePath);

            var result = engine.ReadStream(streamReader);

            var transactions = result.ToList();

            TempData["Message"] = String.Format("Now viewing \"{0}\".", file.FileName);
            TempData["Filename"] = file.FileNameLessExtension;
            return View(transactions);
        }