コード例 #1
0
        public Int32 DeleteConfigurations(ConfigMultiEntries request)
        {
            Int32 response = -1;
            using (var context = new TICPuppyLoveDbContext())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    context.dbTransaction = dbContextTransaction;

                    ConfigDTO cdto = new ConfigDTO { configs = request.ConfigEntries };

                    cdto.refConfigEntries = context.GetRefConfigData();
                    cdto.refConfigEntries = cdto.GetSpecificRefConfigs();

                    context.Ref_Config.RemoveRange(cdto.refConfigEntries);
                    response =  context.SaveChanges();

                    // everything good, commit transaction
                    dbContextTransaction.Commit();
                }
            }

            return response;
        }
コード例 #2
0
        public List<ConfigEntry> GetAllConfigurations()
        {
            List<ConfigEntry> response = new List<ConfigEntry>();
            var result = new ConfigDTO();
            using (var dbEntities = new TICPuppyLoveDbContext())
            {
                result.refConfigEntries = dbEntities.GetRefConfigData();
                response = result.CreateConfigCollection();
            }

            return response;
        }