我需要在删除文件后向用户显示成功消息。不知道该怎么做。请帮忙。删除后显示成功消息
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