-3
This is the method I have in my MVC
public async Task<List<FuncionarioViewModel>> GetFuncionariosVM()
{
string url = $"http://localhost:56137/api/GetFuncionario";
var response = await client.GetStringAsync(url);
var _funcionario = JsonConvert.DeserializeObject<List<FuncionarioViewModel>>(response);
return _funcionario;
}
I need to give m padleft(11) in the CPF field and do not know how to do. Below the get method in the API
public class GetFuncionario
{
BancoContext banco = new BancoContext();
//Método que retorna uma lista de funcionarios
public List<Funcionario> GetFuncionarios()
{
return banco.Database.SqlQuery<Funcionario>("sp_cons_funcionarios").ToList();
}
}
Because it’s a numeric field, I need a padleft(11) for Cpf to start with 0 and cut the 0 to the left. How do I do this?
If you make a simple
Convert.ToInt32(funcionario.cpf);
doesn’t work?– João Martins
I don’t have to work at Get
– pnet
So where do you want to make the entire conversion?
– João Martins
That’s the question I posted. How would I do that?
– pnet
Why do you need it, it looks like a scam and gives you trouble, but I may be wrong, you can explain it better?
– Maniero