ASP.Net MVC Error: Object does not contain a definition for Where

Last Reply 6 months ago By dharmendr

Posted 6 months ago

hi

i create MVC project and wrote below codes:

but below error occure:

http://i65.tinypic.com/rvyplx.jpg

        public bool Delete(int id)
        {
            try
            {
                Student deleted_student = db.Students.Where(p => p.Id == id).Single();
                db.Students.Remove(deleted_student);

                return Convert.ToBoolean(db.SaveChanges());
            }
            catch (Exception)
            {
                return false;
            }
        }

        public Student Find(int id)
        {
            try
            {
                return db.Students.Where(p => p.Id == id).Single();
            }
            catch (Exception)
            {
                return null;
            }

what should I do?

best regards

neda