1
public class HomeController : Controller
{
private ProjetoFornecedorEntities db = new ProjetoFornecedorEntities();
// GET: Home
public ActionResult Index(Fornecedor fornecedor)
{
return View(db.Fornecedor.ToList());
}
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(Fornecedor fornecedor )
{
if (ModelState.IsValid)
{
db.Fornecedor.Add(fornecedor);
db.SaveChanges();
return RedirectToAction("Index");
}
return View("Create");
}
}
Guys I’m going crazy already, my doubt is how not to duplicate fields at registration time for example ,I have a Cpf and can not register the same Cpf and as returns on screen,I searched and found the Remote but could not apply.