I've got an action in my controller
[HttpGet]
[Route("classificators/{type}/{criteria}/{predicate?}")]
public ActionResult Classificators(string type, string criteria, string predicate)
{
try
{
//Lot's of cool code here!
return Json(new { Data = "Cool data!" }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new
{
state = "error",
message = ExceptionReport(ex)
}, JsonRequestBehavior.AllowGet);
}
}
And sending request to it like so..
/classificators/MAIN/CODE/50.1
Where: type - MAIN criteria - CODE predicate - 50.1
But action treats parametr 50.1 like double value so I've got an error. How to specify action to treat this value like a string
Aucun commentaire:
Enregistrer un commentaire