An explicit conversion exists (are you missing a cast?)

后端 未结 6 661
礼貌的吻别
礼貌的吻别 2020-12-10 13:06

I have a method that gives me the groupID of users and then I want to get the news based on the user\'s GroupID.

public IEnumerable Getnews(int G         


        
6条回答
  •  攒了一身酷
    2020-12-10 14:00

    return newsRepository.GetMany(constraint); returns an IEnumerable, you should do:

     return newsRepository.GetMany(constraint).FirstOrDefault();
    

    return the first News if it is found in newRepository, null otherwise

提交回复
热议问题