0
I’m trying to make a method to change via POST in my code and is giving syntax error, I do as follows:
@Ajax.ActionLink(" ", "Usuario", new
{
item.CodigoUsuario
}, new AjaxOptions { UpdateTargetId = "div-usuario-index", HttpMethod = "POST" }, new { @class = "editar btn btn-sm btn-primary glyphicon glyphicon-edit", @name = "command:alterar" })
Controller:
[HttpPost]
[ClearModelState]
[CommandName("Alterar", "command:alterar")]
public async Task<ActionResult> AlterarAsync(UsuarioViewModel model)
{
model = await this.BuscarUsuarioAsync(model.CodigoUsuario);
try
{
var pessoaFisica = await this.PessoaApplicationService.BuscarPessoaCompletaPorCNPJCPFAsync(model.NumeroCpf);
pessoaFisica = pessoaFisica ?? new PessoaFisica();
model.NomeCompleto = pessoaFisica.NomeCompleto;
model.NumeroCpf = pessoaFisica.NumeroCpf;
model.NumeroTelefone = pessoaFisica.NumeroTelefone;
model.DescricaoEndereco = pessoaFisica.DescricaoEndereco;
model.NomeMunicipio = pessoaFisica.NomeMunicipio;
model.DescricaoSenha = string.Empty;
model.RepetirSenha = string.Empty;
model.RepetirSenha = model.DescricaoSenha;
ModelState.Remove("DescricaoSenha");
ModelState.Remove("RepetirSenha");
Session["Id"] = pessoaFisica.Id;
return View("Alterar", model);
}
catch (BusinessException ex)
{
Session["Id"] = model.CodigoUsuario;
HandleBusinessException(ex);
return View("Alterar", model);
}
}
Does anyone know how I can do that ?
There is little information, at which moment the error occurs?
– novic
at compile time it already says that the syntax is incorrect
– Stand Alone
But what line is that there ?
– novic
I changed the way I step in Razor and controller, I edited the post with the changes, now I click change and nothing happens....
– Stand Alone