예제 #1
0
        public async Task <int> Add(ParticipanteSorteio entity)
        {
            var sql = "INSERT INTO ParticipanteSorteio(ParticipanteId, SorteioId) VALUES (@ParticipanteId, @SorteioId)";

            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                var affectedRows = await connection.ExecuteAsync(sql, entity);

                return(affectedRows);
            }
        }
예제 #2
0
        public async Task <int> Update(ParticipanteSorteio entity)
        {
            var sql = "UPDATE Sorteio SET ParticipanteId = @ParticipanteId, SorteioId = @SorteioID" +
                      "WHERE ";

            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                var affectedRows = await connection.ExecuteAsync(sql, entity);

                return(affectedRows);
            }
        }