I want to not let people under age 18 to be able to be registered in the database. I have zero clue in how to do so. I already have the controller up. Here it is.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "nome,cpf,data_nasc")] clientes clientes)
{
try
{
if (ModelState.IsValid)
{
db.Cliente.Add(clientes);
db.SaveChanges();
return RedirectToAction("Index");
}
}
catch (DataException /* dex */ )
{
ModelState.AddModelError("", "Não foi possível salvar as mudanças. Tente de novo e se o problema persistir entre em contato com o administrador de sistema.");
}
return View(clientes);
}