Ejemplo n.º 1
0
        public JObject DelSettings(string id)
        {
            using (BayetechEntities bay = new BayetechEntities())
            {
                var ret = new JObject();
                if (!string.IsNullOrEmpty(id))
                {
                    int _id = Convert.ToInt32(id);

                    Settings settings = bay.Settings.Where(c => c.Id == _id).FirstOrDefault();
                    settings.IsDelete = true;
                    bay.SaveChanges();
                }
                return(ret);
            }
        }
Ejemplo n.º 2
0
 public int Commit()
 {
     try
     {
         var returnValue = dbcontext.SaveChanges();
         if (dbTransaction != null)
         {
             dbTransaction.Commit();
         }
         return(returnValue);
     }
     catch (DbEntityValidationException ex)
     {
         if (dbTransaction != null)
         {
             this.dbTransaction.Rollback();
         }
         throw new Exception(Common.ExceptionForWriteEntity(ex));;
     }
     finally
     {
         this.Dispose();
     }
 }
Ejemplo n.º 3
0
 public int Insert(TEntity entity)
 {
     dbcontext.Entry <TEntity>(entity).State = EntityState.Added;
     return(dbcontext.SaveChanges());
 }