예제 #1
0
        public bool Create(TopicMessageDTO note)
        {
            try
            {
                return(dal.Create(note));
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }
예제 #2
0
 public bool Create(TopicMessageDTO note)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var add_topic_message = connection.CreateCommand();
         add_topic_message.CommandText = $"INSERT INTO dbo.TopicMessage (MessageId, TopicId) VALUES (@MessageId, @TopicId)";
         add_topic_message.Parameters.AddWithValue("@MessageId", note.MessageId);
         add_topic_message.Parameters.AddWithValue("@TopicId", note.TopicId);
         connection.Open();
         var result = add_topic_message.ExecuteNonQuery();
         return(result > 0);
     }
 }
예제 #3
0
        public bool Update(TopicMessageDTO note)
        {
            try
            {
                dal.Update(note);
                return(true);
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }
예제 #4
0
 public bool Update(TopicMessageDTO note)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var update_topic_message = connection.CreateCommand();
         update_topic_message.CommandText = $"UPDATE dbo.TopicMessage SET MessageId = @MessageId, TopicId = @TopicId WHERE Id = @Id";
         update_topic_message.Parameters.AddWithValue("@Id", note.Id);
         update_topic_message.Parameters.AddWithValue("@MessageId", note.MessageId);
         update_topic_message.Parameters.AddWithValue("@TopicId", note.TopicId);
         connection.Open();
         var result = update_topic_message.ExecuteNonQuery();
         return(result > 0);
     }
 }