public bool AddDefender(Defender defender)
        {
            try
            {
                _entityFrameworkDbContext.Set <Defender>().Add(defender);
                _entityFrameworkDbContext.SaveChanges();

                return(true);
            }
            catch (Exception e)
            {
                this._logger.LogError($"Getting the data from config.AuthorizationRoles on config database failed: {e.Message}.");
                throw;
            }
        }
Example #2
0
        public static int SaveChangesWithModificationHistory(this IEntityFrameworkDbContext dbContext)
        {
            BeforeSaveChangesWithHistory(dbContext);

            int result = dbContext.SaveChanges();

            AfterSaveChangesWithHistory(dbContext);

            return(result);
        }
Example #3
0
        // Repositories

        /// <summary>
        /// Save pending changes to the database
        /// </summary>
        public void Commit()
        {
            //System.Diagnostics.Debug.WriteLine("Committed");
            context.SaveChanges();
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Add(T entity)
 {
     Entities.Add(entity);
     return(context.SaveChanges());
 }