Example #1
0
        public void UpdateLevelConfiguration(LevelConfiguration levelConfiguration)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    levelConfiguration.Name,
                    levelConfiguration.Description,
                    levelConfiguration.TargetSpawnDelay,
                    levelConfiguration.TargetLifespan,
                    levelConfiguration.IsPublic
                };

                var sql = SqlCrudHelper.GetUpdateStatement(parameters, levelConfiguration.GetType().Name);
                sql += " WHERE LevelConfigurationId = @LevelConfigurationId";

                db.Execute(sql, levelConfiguration);
            }
        }
Example #2
0
        public Guid CreateLevelConfiguration(LevelConfiguration levelConfiguration)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    levelConfiguration.LevelId,
                    levelConfiguration.OrganisationId,
                    levelConfiguration.CreatedById,
                    levelConfiguration.Name,
                    levelConfiguration.Description,
                    levelConfiguration.TargetSpawnDelay,
                    levelConfiguration.TargetLifespan,
                    levelConfiguration.IsPublic
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, levelConfiguration.GetType().Name, "LevelConfigurationId");

                Guid newId = db.ExecuteScalar <Guid>(sql, parameters);

                return(newId);
            }
        }