I have action method in my ASP.NET Core Web API project that call to function in external C# dll. These functions do calculations to the data that I pass to them and return an output to me. How I do my action function asynchronous? And is it even necessary to do so?
[HttpPost]
public IActionResult SetClac([FromBody] CalcRequest calcRequest)
{
try
{
IClacSdk clacSdk = new CalcSdk();
ClacResult clacResult = clacSdk.clac(calcRequest.id , calcRequest.username)
CustomeResponse customeResponse = new CustomeResponse()
{
ErrorDescription = clacResult.ErrorDescription,
ErrorNum = clacResult.ErrorNum,
ClacResult = clacResult.Result
};
return Ok(customeResponse);
}
catch (Exception exc)
{
return StatusCode(500, (GetErrorFormat(exc)));
}
}