Remembering that while running it does not return any error
Controller
using CRUD.Aplicação;
using DocumentoObjeto.dominio;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Tcc1._6._0.Controllers
{
public class LocalizarController : Controller
{
// GET: Localizar
public ActionResult Index()
{
return View();
}
public ActionResult RetornoObjetoPorCpf()
{
return View();
}
[HttpPost]
public ActionResult RetornoObjetoPorCpf(string cpf)
{
ViewBag.cpf = cpf;
var appAluno = new Inserir_usuario();
var aluno = appAluno.ListarPorCpf(cpf);
if (aluno == null)
return HttpNotFound();
return View(aluno);
}
}
}
View
@model DocumentoObjeto.dominio.Objeto
<div>
<h4>Objeto</h4>
<hr />
<dl class="dl-horizontal" >
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(model => model.cpf, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.cpf, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.cpf, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Buscar" class="btn btn-default" />
</div>
</div>
</div>
<dt>
@Html.DisplayNameFor(model => model.nome)
</dt>
<dd>
@Html.DisplayFor(model => model.nome)
</dd>
<dt>
@Html.DisplayNameFor(model => model.cpf)
</dt>
<dd>
@Html.DisplayFor(model => model.cpf)
</dd>
</dl>
</div>
<p>
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
@Html.ActionLink("Back to List", "Index")
</p>