You could just do this
bool roleIsAdmin = (from objRole_mappings in context.Role_mappings.Where(objRole_mapping => objRole_mapping.User_id == UserId)
join objRoles in context.Roles on objRole_mappings.Role_id equals objRoles.ID
select
objRoles.Is_admin
).FirstOrDefault();
This way your function will
return roleIsAdmin == true ? 1 : 0;