I need to return the value of a query of the query in an int variable, to be able to compare with my TextBox, but I can not make the comparison because it can not compare integer (textbox) with a group of methods (jquery), follow my code below.
Class Control:
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);
}
}