Exemple #1
0
 public bool Add(TEntity entity)
 {
     try
     {
         Context.Set <TEntity>().Add(entity);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public void Add(TEntity entity)
 {
     try
     {
         Context.Set <TEntity>().Add(entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
        public bool Add(TEntity entity)
        {
            try
            {
                Context.Set <TEntity>().Add(entity);
                return(true);
            }
            catch (AggregateException)
            {
                return(false);
            }

            catch (NullReferenceException)
            {
                return(false);
            }
            catch (FormatException)
            {
                return(false);
            }
        }
Exemple #4
0
 public T Add(T entity)
 {
     _context.Set <T>().Add(entity);
     return(entity);
 }
 public GeneralRepository(BDContext cafeContext)
 {
     _dbSet     = cafeContext.Set <T>();
     _dbContext = cafeContext;
 }
Exemple #6
0
 public void Add(TEntity entity)
 {
     _ctx.Set <TEntity>().Add(entity);
 }
Exemple #7
0
 public IQueryable <TEntity> GetAll()
 {
     return(ctx.Set <TEntity>());
 }
 public TEntity Get(int id)
 {
     return(Context.Set <TEntity>().Find(id));
 }