public Guid CreatePasswordReset(PasswordReset passwordReset)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    passwordReset.UserAccountId
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, passwordReset.GetType().Name, "PasswordResetId");

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

                return(newId);
            }
        }
Beispiel #2
0
        public Guid CreateLevel(Level level)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    level.Name,
                    level.Description
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, level.GetType().Name, "LevelId");

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

                return(newId);
            }
        }
Beispiel #3
0
        public Guid CreateOrganisation(Organisation organisation)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    organisation.OrganisationName,
                    organisation.CreatedById
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, organisation.GetType().Name, "OrganisationId");

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

                return(newId);
            }
        }
Beispiel #4
0
        public Guid CreateScoreboard(Scoreboard scoreboard)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    scoreboard.UserAccountId,
                    scoreboard.LevelConfigurationId,
                    scoreboard.Score
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, scoreboard.GetType().Name, "ScoreboardId");

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

                return(newId);
            }
        }
        public Guid CreateTargetZone(TargetZone targetZone)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    targetZone.TargetZoneShape,
                    targetZone.TargetZoneX,
                    targetZone.TargetZoneY,
                    targetZone.TargetZoneZ
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, targetZone.GetType().Name, "TargetZoneId");

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

                return(newId);
            }
        }
        public Guid CreateTargetAppearance(TargetAppearance targetAppearance)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    targetAppearance.TargetId,
                    targetAppearance.ScoreboardId,
                    targetAppearance.TargetUptime,
                    targetAppearance.WasMissed
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, targetAppearance.GetType().Name, "TargetAppearanceId");

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

                return(newId);
            }
        }
        public Guid CreateOrganisationMembership(OrganisationMembership organisationMembership)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    organisationMembership.OrganisationId,
                    organisationMembership.UserAccountId,
                    organisationMembership.UserType,
                    organisationMembership.OrganisationInviteId
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, organisationMembership.GetType().Name, "OrganisationMembershipId");

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

                return(newId);
            }
        }
        public Guid CreateUserAccount(UserAccount userAccount)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    userAccount.UserAccountId,
                    userAccount.Name,
                    userAccount.EmailAddress,
                    userAccount.Salt,
                    userAccount.Hash,
                    userAccount.CreatedDate,
                    userAccount.IsDeleted
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, userAccount.GetType().Name, "UserAccountId");

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

                return(newId);
            }
        }
Beispiel #9
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);
            }
        }
Beispiel #10
0
        public Guid CreateTarget(Target target)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var parameters = new
                {
                    target.LevelConfigurationId,
                    target.TargetShape,
                    target.TargetX,
                    target.TargetY,
                    target.TargetZ,
                    target.OffsetX,
                    target.OffsetY,
                    target.OffsetZ
                };

                var sql = SqlCrudHelper.GetInsertStatement(parameters, target.GetType().Name, "TargetId");

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

                return(newId);
            }
        }