无法将 lambda 表达式转换为类型“bool”,因为它不是委托类型
在 if 语句“if (UserLevelID => dbMinimunlevelID)”中比较 2 个整数时
如何将包含计数的变量与另一个整数进行比较?
//Check if user has enough credits to create ClassCharacter
public bool CheckMinimunCreditforClassCharacter(Guid UserID, int ClassCharacterID, int Levelid)
{
bool Results = true;
//Check Character Creation Rules
int dbMinimunlevelID = 0;
bool AdditionalCharactersRequired = false;
int AdditionalCharactersPoints = 0;
var query = (from o in db.ClassCharacters
where o.ClassCharacterID == ClassCharacterID
select o);
foreach (var v in query)
{
dbMinimunlevelID = v.MinimumPoints;
AdditionalCharactersRequired = v.AdditionalCharactersRequired;
AdditionalCharactersPoints = v.AdditionalCharactersPoints;
}
if (dbMinimunlevelID > 0)
{
//Check User existing Characters
int UserLevelID = db.Characters.Where(o => o.UserId == UserID)
.Max(o => o.LevelID);
//************ Here is where the error appears
if (UserLevelID => dbMinimunlevelID)
{
Results = true;
}
else
{
Results = false;
}
}
return Results;
}