public IActionResult TwinParadoxPtoS(string number1, string number2) { string mymessage = _twinParadoxmessage; mymessage += _twinParadoxStoP; string myresult = ""; try { var num1 = Decimal.Parse(number1); var num2 = Decimal.Parse(number2); if ((num1 > 1 || num1 < 0) || (num2 < 0)) { myresult = "Invalid parameter ranges"; } else { myresult = TimeDilation.TwinParadox(num1, num2, false).ToString(); } } catch (Exception e) { myresult = "Inproper input number or it's beyond the range of decimal precision."; } TempData["message"] = mymessage; TempData["param1message"] = _twinparam1; TempData["CallingAction"] = "TwinParadoxPtoS"; TempData["CallingController"] = "Physics"; TempData["param2message"] = _PtoStime; TempData["result"] = myresult; TempData["param1"] = number1; TempData["param2"] = number2; return(RedirectToAction("TwoFunctionResult", "Results", new { description = "TwinParadoxPtoS" })); }
public async Task <IActionResult> TimeDilationShipTime(string speed, string time) { var parsResultSpeed = TryParser.TryDecimalParse(speed, 0.0m, 1.0m); var parsResultTime = TryParser.TryDecimalParse(time, 0.0m); if (parsResultSpeed.Item1 && parsResultTime.Item1) { var SPEED = parsResultSpeed.Item2; var TIME = parsResultTime.Item2; var result = await Task.Run(() => { return(TimeDilation.TwinParadox(SPEED, TIME, true)); }); return(Ok(result)); } else { return(BadRequest("improper speed or time, or inproper input parameters")); } }