Esempio n. 1
0
        public virtual bool Update(C item)
        {
            bool returnValue = false;

            using (var context = new DB_PASTEBOOKEntities())
            {
                context.Entry(item).State = EntityState.Modified;
                returnValue = context.SaveChanges() != 0;
            }

            return(returnValue);
        }
Esempio n. 2
0
        public virtual bool Remove(Expression <Func <C, bool> > where)
        {
            bool returnValue = false;

            using (var context = new DB_PASTEBOOKEntities())
            {
                var item = context.Set <C>().Where <C>(where).FirstOrDefault();
                context.Entry(item).State = EntityState.Deleted;
                returnValue = context.SaveChanges() != 0;
            }

            return(returnValue);
        }