1
Precise returns the value of a query query in an int variable, to be able to make the comparison with my Textbox, but I cannot make the comparison because I cannot compare integer(textbox) with a group of methods(jquery), follow my code below.
Controlerota Class:
public IList<Rota> ConsultaCarro (int NVeiculoId)
{
string hql = "SELECT * FROM Rota r WHERE r.NVeiculoId = :NVeiculoId";
IQuery query = session.CreateQuery(hql);
query.SetParameter("NVeiculoId", NVeiculoId);
return query.UniqueResult<Rota>();
return query.List<Rota>();
}
Controller:
public ActionResult Adicionar(RotaModel viewModel)
{
if (/*Onde entraria o valor da query*/ = viewModel.NVeiculoId)
{
}
if (viewModel.Km_Atual < 85000)
{
ModelState.AddModelError("Km_Atual.Invalido",
"A quilometragem precisa ser maior que a anterior");
}
if (ModelState.IsValid)
{
Rota rota = viewModel.CriaRota();
dao.Adicionar(rota);
//return View();
return RedirectToAction("Form");
}
else
{
ViewBag.Veiculo = veiculoDao.Lista();
return View("Index", viewModel);
}
}
Please avoid long discussions in the comments; your talk was moved to the chat
– bfavaretto