public T Add(T entity)
        {
            _dbContext.Set <T>().Add(entity);
            _dbContext.SaveChanges();

            return(entity);
        }
        public T Add(T entity)
        {
            try
            {
                _dbContext.Set <T>().Add(entity);
                _dbContext.SaveChanges();

                return(entity);
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
                throw ex;
            }
        }
Exemplo n.º 3
0
        public T Add(T entity)
        {
            try
            {
                entity.CreatedDate = Helpers.UTC_To_IST();//Rita 3-11-2018 no need to set at all type
                _dbContext.Set <T>().Add(entity);
                _dbContext.SaveChanges();

                return(entity);
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "An unexpected exception occured,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
                throw ex;
            }
        }
Exemplo n.º 4
0
 public int SaveChanges()
 {
     return(_context.SaveChanges());
 }