Rahul Sharma

Rahul Sharma

  • NA
  • 194
  • 14k

How to Validate parameter in asp.net core 3.0 web api's get request?

May 23 2021 5:34 AM
I want to validate the parameter in  web api's get request. How to achieve this.
 
code:
 
  1. [HttpGet("{id}")]  
  2. public async Task<ActionResult<Schedd>> GetSchedd(string id)  
  3. {   
  4.     return Ok(await _context.Schedds.FromSqlRaw<Schedd>("sp_userprofile {0},{1},{2}", id, 7, null).ToListAsync());  
  5. }  
 
Here String id must not contain any symbol or alphapet. 
 

Answers (2)