问题描述
有没有办法从剃刀页面调用 C# 方法? 我正在使用 ASP.NET Core Web 应用程序来创建一个应用程序,该应用程序显示温度结果并在用户单击按钮时将报告保存到用户的计算机。我有这个方法:
public void SaveReport() {
string dateTime = DateTime.Now.Day + "." + DateTime.Now.Month + "." + DateTime.Now.Year + "(" + DateTime.Now.Hour + "." + DateTime.Now.Minute + "." + DateTime.Now.Second + "." + DateTime.Now.Millisecond + ")";
string fileName = "Report(" + dateTime + ")" + ".txt";
TextWriter tw = new StreamWriter("../../Report/" + fileName,true);
tw.WriteLine("Time of report: " + DateTime.Now);
tw.WriteLine("Closest to 0: {0}",Analyser.ClosestToZero());
tw.WriteLine("Mean temperature: {0}",Analyser.MeanTemperature());
tw.WriteLine("Net rate: {0}",Analyser.NetRate());
tw.WriteLine("Date of lowest positive temperature: {0}",Analyser.DateOfLowestPositiveTemperature());
tw.WriteLine("Date of highest negative temperature: {0}",Analyser.DateOfHighestNegativeTemperature());
tw.WriteLine("Date temperature was closets to the mean: {0}",Analyser.DateClosestToMeanTemperature());
tw.WriteLine("Date temperature will reach 200°C: {0}",Analyser.WillReachBy(200));
tw.Close();
}
我想从这个按钮调用 if
<a class="btn btn-success">Save Report</a>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)