I have a method that takes an object that can be both int and string, does anyone know a way to make the entity framework to interpret the object !?
I know I can do an if and do the check, but I'm trying to make a simpler way it will use in various parts of the code.
Below is sample code:
public JsonResult LoadForm(object id) {
if ((form = db.tbSystFormulario.FirstOrDefault(f => f.pk_id.CompareTo(id) == 0)) == null)
{
form = db.tbSystFormularioCampo.FirstOrDefault(f => f.tx_nome.CompareTo(id) == 0);
}
return Json(LoadForm(form), JsonRequestBehavior.AllowGet);
}