public IEnumerable <T> GetById(int id) { using (var entity = new ModelDataEntities2()) { return(entity.Set <T>().Where(x => x.Id == id).ToList()); } }
public IEnumerable <T> GetAll() { using (var context = new ModelDataEntities2()) { var entity = context.Set <T>().ToList(); return(entity); } }
public int Insert(T item) { using (var context = new ModelDataEntities2()) { var entity = context.Set <T>().Add(item); context.SaveChanges(); return(item.Id); } }