public int GetPositionId(string nombrecargo)
{
try
{
var query = from pos in entities.cargos
where nombrecargo == pos.cargo1
select pos.id;
int posId = Convert.ToInt32(query.First());
return posId;
}catch(Exception err){
throw new Exception(err.ToString() + "--Empleados.cs / GetPositionId(string)");
}
}