Hi I have some coding issue here, what I am trying to do is based on the input SYSID
, find the list of name from table, just for testing purpose.
Model:
public DbSet<firsttest> firsttests { get; set; }
Table:
[Table("FirstTest")]
public class firsttest
{
public firsttest(){}
[Column("sysId")]
public long SysId { get; set; }
public string Name { get; set; }
}
Controller:
[Authorize]
[Route("api/FirstTest/{SysId}")]
public List<String> Name(long SYSID)
{
using (AContext db = new AContext())
{
var query = db.firsttests.Where(a => 1 == 1);
if (!String.IsNullOrEmpty(SYSID.ToString()))
{
query = query.Where(a => a.SysId.Equals(SYSID)).Select(a => a.Name);
}
return query.ToList();
}
}
The error is : cannot implicitly convert type System.Linq.Iqueryable(string) to System.Linq.Iqueryable(Model.firsttest)
Any idea how to modify the code?