static void Main(string[] args) { dietPlansBs b = new dietPlansBs(); Console.WriteLine(b.BMICalculator(54, 170)["BMI"]); Console.ReadKey(); }
public IHttpActionResult BMICalculator(BMICalculatorObj obj) { try { if (obj.height <= 0 || obj.weight <= 0) { return(BadRequest("height or weight is null")); } Dictionary <string, object> result = dietPlanObj.BMICalculator(obj.weight, obj.height); resObj.Data = result; resObj.Message = "BMI calculated"; resObj.Status = HttpStatusCode.OK; return(Ok(resObj)); } catch (Exception e) { return(BadRequest("Some error has occured. Error message : " + e.Message)); } }