0
public PartialViewResult Index(string quantidadeRegistro)
{
int qtd;
int.TryParse(quantidadeRegistro, out qtd);
var bdPedido = PedidosAplicacaoConstrutor.PedidosAplicacaoEF();
var bdCliente = ClientesAplicacaoConstrutor.ClientesAplicacaoEF();
IEnumerable<Pedidos> pedidos;
if (qtd < 1)
pedidos = bdPedido.ListarTodos().OrderByDescending(x => x.ID);
else
pedidos = bdPedido.ListarTodos().OrderByDescending(x => x.ID).Take(qtd);
ViewData["Clientes"] = bdCliente.ListarTodos();
return PartialView(pedidos);
}
[HttpPost]
public PartialViewResult Editar(FormCollection collection)
{
var bdPedido = PedidosAplicacaoConstrutor.PedidosAplicacaoEF();
var status = collection["status"];
var id = collection["ID"];
var pedido = bdPedido.ListarPorId(id);
pedido.Status = status;
bdPedido.Salvar(pedido);
return RedirectToAction("Index");
}
function Open(url) {
$('#Conteudo').empty().append('<div id="loader"><img src="/Content/Images/loading.gif"/></div>');
$.get(url,function(response){
$('#Conteudo').html(response);
$('#loader').remove();
});
}
<button type="submit" class="btn btn-success">Salvar</button>
I can’t get Edit to send it to Index. Replaces the Edit Partialviewresult by Actionresult works, but then I lose the "layout" of the page, because I use AJAX.
To not lose the layout, Diego, you must use Handler
.on
. If you post your AJAX, I can help you better.– Guilherme Oderdenge
I edited the post, see if this is it!
– Diego Zanardo
Who calls this their function
Open
?– Guilherme Oderdenge
The Hyperlinks!!
– Diego Zanardo