I have to a modify the IActionResult
according to certain property of my custom object.
I am trying different ways to change but neither worked
public static class ExtensionMethods
{
public static IActionResult Change(this Controller controller, ExternalResponse obj)
{
if (case 1)
{
return Ok(extResp);
}
else if(case 2)
{
return NotFound(extResp);
}
else if(case 31)
{
return Unauthorized();
}
else
{
return BadRequest(extResp);
}
}
public static IActionResult ChangeTwo(this ControllerBase controller, ExternalResponse obj)
{
if (case 1)
{
return Ok(extResp);
}
else if(case 2)
{
return NotFound(extResp);
}
else if(case 31)
{
return Unauthorized();
}
else
{
return BadRequest(extResp);
}
}
}
Please suggest what can I do.