Exemple #1
0
        public bool Create(UserTopicDTO note)
        {
            try
            {
                return(dal.Create(note));
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }
Exemple #2
0
 public bool Create(UserTopicDTO note)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var add_user_topic = connection.CreateCommand();
         add_user_topic.CommandText = $"INSERT INTO dbo.UserTopic (UserId, TopicId) VALUES (@UserId, @TopicId)";
         add_user_topic.Parameters.AddWithValue("@UserId", note.UserId);
         add_user_topic.Parameters.AddWithValue("@TopicId", note.TopicId);
         connection.Open();
         var result = add_user_topic.ExecuteNonQuery();
         return(result > 0);
     }
 }
Exemple #3
0
 public bool Update(UserTopicDTO note)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var update_user_topic = connection.CreateCommand();
         update_user_topic.CommandText = $"UPDATE dbo.UserTopic SET UserId = @UserId, TopicId = @TopicId WHERE Id = @Id";
         update_user_topic.Parameters.AddWithValue("@Id", note.Id);
         update_user_topic.Parameters.AddWithValue("@SectionId", note.UserId);
         update_user_topic.Parameters.AddWithValue("@TopicId", note.TopicId);
         connection.Open();
         var result = update_user_topic.ExecuteNonQuery();
         return(result > 0);
     }
 }
Exemple #4
0
        public bool Update(UserTopicDTO note)
        {
            try
            {
                dal.Update(note);
                return(true);
            }

            catch (Exception e)
            {
                Logger.Logger.WriteLog(e);
                throw e;
            }
        }