Exemple #1
0
        //삭제
        public void Delete(T entity)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                context.Entry(entity).State = EntityState.Deleted;

                context.SaveChanges();
            }
        }
Exemple #2
0
        public bool InsertOrUpdate(Barcode barcode)
        {
            using (PCBVIEntities context = new PCBVIEntities())
            {
                context.Entry(barcode).State = barcode.BarcodeId != 0 ? EntityState.Modified : EntityState.Added;

                try
                {
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    if (e != null)
                    {
                        return(false);
                    }
                }
                return(true);
            }
        }