I created an API in Visual Studio Community 2017 that is supposed to load data from a MS SQL server. I created getters for the API to look for certain fields, ex ID, Name. The name getter is working but the ID getter stopped working after my first test and I have no idea why since the other getter are still working.
public IEnumerable<TableName> GET()
{
DBEntities entities = new DBEntities();
return entities.TableName.ToList();
}
public TableName Get(string name)
{
DBEntities entities = new DBEntities();
return entities.TableName.FirstOrDefault(e => e.Name == name);
}
public TableName Get(int id)
{
DBEntities entities = new DBEntities();
return entities.TableName.FirstOrDefault(e => e.ID == id);
}
Does anyone know what I need to do to make the ID getter to work again?