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

Delete() public method

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

            var fullPath = GetNamedFile(id).FilePath;

            var file = new FileInfo(fullPath);

            if (file.Exists)
            {
                file.Delete();
                //deleteSuccess = true;
            }

            Message = String.Format("File \"{0}\" has been deleted.", file.Name);
            return RedirectToAction("Index");
        }