using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; using WebApplication1.Models; namespace WebApplication1.DAL { public class Student : _Student where T : class { private StudentEntities _context; private IDbSet dbEntity; public Student() { _context = new StudentEntities(); dbEntity = _context.Set(); } public void DeleteModel(int ID) { T model = dbEntity.Find(ID); dbEntity.Remove(model); } public IEnumerable GetModel() { return dbEntity.ToList(); } public T GetModelByID(int modelID) { return dbEntity.Find(modelID); } public void InsertModel(T model) { dbEntity.Add(model); } public void save() { _context.SaveChanges(); } public void UpdateModel(T model) { _context.Entry(model).State = System.Data.Entity.EntityState.Modified; } } }