I'm writing Api with Visual Studio, but I get errors.
Login login = new Login();
//set some properties
db.Logins.Add(login);
db.SaveChanges();
'IEnumerable' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'IEnumerable' could be found (are you missing a using directive or an assembly reference?)
And:
var user = db.Logins.Where(x => x.UserName == username &&
x.Password == password).FirstOrDefault();
'object' does not contain a definition for 'UserName' and no extension method 'UserName' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Please help me.
db
? Is it a DbContext? Please right-clickgo to definition
atLogins
and show us that code as well. – StefanDbSet<Login>
. If it was it would work, so please show the code ofdb
as well. – Stefan