I'm trying to pass a null argument to a web api controller but I'm getting "null" instead of null.
E.g : my route should be like this
[Route("api/student/GetStudent/{studentId}/{studentFname}/{studentLname}/")]
public Student GetStudent(int studentId,string studentFname,string studentLname)
{
//Code
}
Note that at least user should insert first name or last name and isn't required to have both
In the above code , both firstname and lastname are required but I don't want this. So I change my code to be like this
[Route("api/student/GetStudent/{studentId}/{studentFname?}/{studentLname?}/")] public Student GetStudent(int studentId,string studentFname,string studentLname) { //Code }
As I said that when I call this method and pass a null argument for student firstname . I am getting "null" and when it pass to the database stored procedure it will pass as a value.