In c# we have try & catch block we know how to avoid "Attempted to divide by zero
But in WebAPi2.0 how can i Restricts user not Enter 1/0 Or -1/0
public IHttpActionResult div(int a, int b)
{
return Ok(a / b);
}
In c# we have try & catch block we know how to avoid "Attempted to divide by zero
But in WebAPi2.0 how can i Restricts user not Enter 1/0 Or -1/0
public IHttpActionResult div(int a, int b)
{
return Ok(a / b);
}
Copyright © 2021 Jogjafile Inc.
You handle this the exact same way. Web Api is only one way of handle communication. The C# logic remains the same.
This is an example of how to do it using DI