public TEntity Update(TEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            m_context.Set <TEntity>().Attach(entity);
            m_context.Entry(entity).State = EntityState.Modified;
            m_context.SaveChanges();
            return(entity);
        }
 public TEntity Add(TEntity entity)
 {
     if (entity == null)
     {
         return(null);
     }
     m_context?.Set <TEntity>().Add(entity);
     m_context?.SaveChanges();
     return(entity);
 }
Beispiel #3
0
 protected override void Seed(DbContext context)
 {
     context.AddRange(Customers);
     context.SaveChanges();
 }
Beispiel #4
0
 public int SaveChanges()
 {
     return(_context.SaveChanges());
 }