I'm doing a vehicle registration, I need it to register that whenever a vehicle is registered to zero instead of the value null, I tried by default, but it does not record the information.
I'm using SQL Server along with C # in visual studio.
Controller class:
public ActionResult Adiciona(VeiculoModel viewModel)
{
if (ModelState.IsValid)
{
Veiculo Veiculo = viewModel.CriaVeiculo();
dao.Adiciona(Veiculo);
//return View();
return RedirectToAction("Form");
}
else
{
return View("Index", viewModel);
}
}
DAO Class:
public void Adiciona(Veiculo post)
{
ITransaction tx = session.BeginTransaction();
session.Save(post);
tx.Commit();
}