I am trying to retrieve some records from the database based on an ID parameter that comes in. How ever it gives me an error saying
Cannot implicitly convert type System.Collection.Generic.IEnumerable SourceModel to SourceModel.An explicit conversion exists(are you missing a cast)
This is the part of the query to connect to the db
public static class Source
{
public static IEnumerable<SourceModel> GetRecords(string ID, Func<SourceModel,bool> criteria = null)
{
var command = new StringBuilder();
command.AppendFormat("Select * from [RecordsTable] where ID={0}", ID);
return ExecuteQuery(command.ToString());
}
}
This is the code I tried to pass as follows
public static SourceModel GetRecord(string ID)
{
var recs = Source.GetRecords(ID);
return recs; // on this line when i am trying to return the records i get the above mentioned error
}