我需要在刪除文件後向用戶顯示成功消息。不知道該怎麼做。請幫忙。刪除後顯示成功消息
public ActionResult deleteGeneratedInvoice(string invoiceNumber)
{
try
{
string fileName = invoiceNumber.Trim() + ".pdf";
string filePath = HostingEnvironment.MapPath("~/Content/reports/");
string fullFilePath = filePath + fileName;
System.IO.File.Delete(fullFilePath);
//What shall i return here to display message?
return
}
catch (Exception e)
{
InvoiceSearchTool.Models.udtExceptionTable exception = new udtExceptionTable();
exception.MethodName = "deleteGeneratedInvoice";
exception.Exception = e.ToString();
exception.Date = DateTime.Now;
DYNAMICS_EXTEntities db = new DYNAMICS_EXTEntities();
db.AddToudtExceptionTables(exception);
db.SaveChanges();
//return View ("Error");
}
}
請解釋你對我的答案downvote,併成爲一個公平的人,並將其刪除。畢竟,我用我的時間試圖幫助你,並提出了一個有效的答案.. –
downvoted,因爲它不同於我問,試圖刪除它,但不能因爲它被鎖定...請不要被冒犯,如果僅僅是聲譽問題,我會接受你的答案。 – 14578446