Example #1
0
        public Pair <bool, T> Edit(Expression <Func <T, bool> > whereSelector, Func <T, T> infoFunctor)
        {
            var temp   = new Pair <bool, T>();
            var result = FindInfo(whereSelector).SingleOrDefault();

            Assert(result != null);
            var info = infoFunctor.Invoke(result);

            db.Entry <T>(info).State = System.Data.Entity.EntityState.Modified;
            temp.first  = db.SaveChanges() > 0;
            temp.second = info;
            return(temp);
        }
Example #2
0
 public bool Update(Product entity)
 {
     if (Get(entity.Id) != null)
     {
         var OrderInDb  = Get(entity.Id);
         var OrderEntry = _ctx.Entry(OrderInDb);
         OrderEntry.CurrentValues.SetValues(entity);
         return(true);
     }
     else
     {
         return(false);
     }
 }