Esempio n. 1
0
 public virtual IList <ModelType> GetAll()
 {
     using (var context = new Find3dPrintingDBContext())
     {
         return(context.Set <ModelType>().ToList());
     }
 }
Esempio n. 2
0
 public virtual ModelType GetById(int id)
 {
     using (var context = new Find3dPrintingDBContext())
     {
         return(context.Set <ModelType>().Find(id));
     }
 }
Esempio n. 3
0
 public virtual void Remove(ModelType model)
 {
     using (var context = new Find3dPrintingDBContext())
     {
         context.Set <ModelType>().Remove(model);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
        public virtual ModelType GetFirst()
        {
            return(new ModelType());

            using (var context = new Find3dPrintingDBContext())
            {
                return(context.Set <ModelType>().First());
            }
        }
Esempio n. 5
0
        public virtual void Remove(int id)
        {
            ModelType modelToDelete = this.GetById(id);

            using (var context = new Find3dPrintingDBContext())
            {
                context.Set <ModelType>().Remove(modelToDelete);
                context.SaveChanges();
            }
        }