Skip to content

Instantly share code, notes, and snippets.

@isdaviddong
Created December 28, 2016 10:23
Show Gist options
  • Save isdaviddong/a54d438a56f99844a05b70178722f52d to your computer and use it in GitHub Desktop.
Save isdaviddong/a54d438a56f99844a05b70178722f52d to your computer and use it in GitHub Desktop.
public partial class _default : System.Web.UI.Page
{
/// <summary>
/// 計算BMI
/// </summary>
/// <param name="height">身高</param>
/// <param name="weight">體重</param>
/// <returns></returns>
[System.Web.Services.WebMethod(enableSession: true)]
public static PageMethodDefaultResult<float> BMI(float height, float weight)
{
height = (height) / 100;
var bmi = weight / (height * height);
var result = new PageMethodDefaultResult<float>()
{
Data = bmi,
isSuccess = true
};
return result;
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment