1
I have a small problem, in the image below I have a list of customers. There is a button that opens a modal for editing, it works normal, but after editing the close modal and need to update the list information.
Follow my code below:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Editar(Cliente cliente)
{
cliente.Ativo = true;
try
{
using (SistemaDBEntities db = new SistemaDBEntities())
{
db.Entry(cliente).State = EntityState.Modified;
db.SaveChanges();
}
}
catch (Exception ex)
{
}
return RedirectToAction("Index");
}
Someone knows how to do it?
Your Edit Action is being called?
– Randrade
You are using Ajax for Modal?
– Leonel Sanches da Silva
Friend if you use Modal recording in Ajax your screen would need to be updated also with Ajax, with Angular or Jquery (indicate Angular) and when receiving from this method the answer that recorded would update the new data, wonder how you do it ?
– Cezar
@Cezar I write the data with ajax, which would be the encoding to update via ajax?
– user31040
You load the initial data as?
– Cezar
I carry it like this:
db.Cliente.First(c => c.Codigo == id)
– user31040
I already solved.... When I ran my ajax I put type as GET and it worked. Thank you all.
– user31040