I want the user submitted value to arrive in the MS SQL DB as a SOUNDEX value. eg. soundex(Amnesia) = A520
I have this Function in my dbcontext:
[DbFunction(name: "SOUNDEX", IsBuiltIn = true, IsNullable = false)]
public string Soundex(string query )
{
throw new NotImplementedException();
}
This works fine if I perform a GET but I want to POST.
this is the NameRequest DTO
name = {
Sndx: '',
FirstName: 'Biggus',
LastName: 'Dikuss'
}
In my controller I have:-
public async Task<ActionResult<NameRequest>> PostName(NameRequest name)
{
name.Sndx = _context.Soundex(name.FirstName); //it fails here
await _context.SaveChangesAsync();
return Ok();
}