Exemple #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);
            }
        }
Exemple #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();
     }
 }
 public int Insert(TEntity entity)
 {
     dbcontext.Entry <TEntity>(entity).State = EntityState.Added;
     return(dbcontext.SaveChanges());
 }