Exemplo n.º 1
0
        public static int UpdateRange(IEnumerable <T> tables)
        {
            var db = new DBcon <T>();

            foreach (var table in tables)
            {
                db.Entry(table).State = EntityState.Modified;
            }
            return(db.SaveChanges());
        }
Exemplo n.º 2
0
        public static int Update(T model)
        {
            var db   = new DBcon <T>();
            var db2  = new DBcon <T>();
            var data = db2.Table.Find(model.ID);

            if (data != null && data.Deleted != true)
            {
                model.UpdateDate      = DateTime.Now;
                model.CreateDate      = data.CreateDate;
                model.UserID          = data.UserID;
                db.Entry(model).State = EntityState.Modified;
                return(db.SaveChanges());
            }
            else
            {
                throw new DataStoreException("We can't find the selected data to update");
            }
        }