Click here to Skip to main content
15,845,469 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Richard MacCutchan5-Oct-23 3:43
mveRichard MacCutchan5-Oct-23 3:43 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 4:24
Rod at work5-Oct-23 4:24 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 4:54
Rod at work5-Oct-23 4:54 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Richard MacCutchan5-Oct-23 5:18
mveRichard MacCutchan5-Oct-23 5:18 
AnswerRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
jschell5-Oct-23 6:48
jschell5-Oct-23 6:48 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
Rod at work5-Oct-23 11:33
Rod at work5-Oct-23 11:33 
GeneralRe: How do I use Visual Studio user secrets and GitHub secrets, in the same project? Pin
jschell6-Oct-23 8:10
jschell6-Oct-23 8:10 
QuestionBeginner: Return properties from another Class Pin
Member 159530274-Oct-23 0:58
Member 159530274-Oct-23 0:58 
Hi!

I'm a beginner in C# and need some help.
In Winforms I've got a button. When I press the button I'd like to get some data from TMDB and insert it to MS SQL.

I've redacted some properties to cut down unnecessary properties.

This is what I've got:

Forms.cs:
C#
public void btn_GetNewTVShowData_Click(object sender, EventArgs e)
{
    GetTMDB GetData = new GetTMDB();
    GetData.GetTvShowData();
}


DataClasses\Common\GetTMDB.cs
C#
DataClasses\Common\GetTMDB.cs
namespace WinFormsApp1.DataClasses.Common
{
    internal class GetTMDB
    {
        public async Task<string> GetTvShowData()
        {

 
            HttpClient client = new HttpClient();

            var content = await client.GetStringAsync("https://api.themoviedb.org/3/tv/136311?api_key=XXXXXXX&language=en-US");


            TVShow myDeserializedClass = JsonConvert.DeserializeObject<TVShow>(content);


            return object myDeserializedClass;  <-- Not working, I know

        }

        public class TVShow
        {
            public string backdrop_path { get; set; } = default!;
            public List<CreatedBy> created_by { get; set; } = default!;
            public string name { get; set; } = default!;
        }
		
		 public class CreatedBy
        {
            public int id { get; set; } = default!;
            public string credit_id { get; set; } = default!;
            public string name { get; set; } = default!;
            public int gender { get; set; } = default!;
            public string profile_path { get; set; } = default!;
        }
    }
}


DataClasses\Common\DataAccess.cs (psedocode, just for showing I want it in seperate class)
C#
INSERT INTO table_name (column1, column2) VALUES (value1, value2);


So, I want to press a button, use the class GetTMDB, get the json from TMDB, Serialize it (with NewtonSoft.json), return the data back to my forms1.cs (I guess? Or should I call DataAccess.cs?).
Is it possible to let another class access the properties?
Let's say I want multiple classes to access the Properties to do different kind of stuff with my properties.
AnswerRe: Beginner: Return properties from another Class Pin
Gerry Schmitz4-Oct-23 5:32
mveGerry Schmitz4-Oct-23 5:32 
AnswerRe: Beginner: Return properties from another Class Pin
Dave Kreskowiak4-Oct-23 6:36
mveDave Kreskowiak4-Oct-23 6:36 
QuestionUsing await/async Correctly Pin
Kevin Marois25-Sep-23 13:30
professionalKevin Marois25-Sep-23 13:30 
AnswerRe: Using await/async Correctly Pin
Gerry Schmitz25-Sep-23 17:13
mveGerry Schmitz25-Sep-23 17:13 
GeneralRe: Using await/async Correctly Pin
Kevin Marois25-Sep-23 17:49
professionalKevin Marois25-Sep-23 17:49 
GeneralRe: Using await/async Correctly Pin
Gerry Schmitz25-Sep-23 18:06
mveGerry Schmitz25-Sep-23 18:06 
AnswerRe: Using await/async Correctly Pin
Richard Deeming25-Sep-23 22:52
mveRichard Deeming25-Sep-23 22:52 
QuestionWin Forms, WPF, WinUI 3 Pin
Member 1210196924-Sep-23 11:04
Member 1210196924-Sep-23 11:04 
AnswerRe: Win Forms, WPF, WinUI 3 Pin
Gerry Schmitz24-Sep-23 19:08
mveGerry Schmitz24-Sep-23 19:08 
Question.NET 4.7 Desktop Form combox coloring within datagridview Pin
.NET4Ever22-Sep-23 5:50
.NET4Ever22-Sep-23 5:50 
AnswerRe: .NET 4.7 Desktop Form combox coloring within datagridview Pin
Alan N22-Sep-23 14:40
Alan N22-Sep-23 14:40 
GeneralRe: .NET 4.7 Desktop Form combox coloring within datagridview Pin
.NET4Ever25-Sep-23 5:02
.NET4Ever25-Sep-23 5:02 
QuestionWhat are Custom Control and User Control? Pin
Emmanuel Katto22-Sep-23 2:31
professionalEmmanuel Katto22-Sep-23 2:31 
AnswerRe: What are Custom Control and User Control? Pin
OriginalGriff22-Sep-23 3:23
mveOriginalGriff22-Sep-23 3:23 
GeneralRe: What are Custom Control and User Control? Pin
Gerry Schmitz22-Sep-23 5:05
mveGerry Schmitz22-Sep-23 5:05 
QuestionFIREBASE Filter Data from Date to Date Pin
sameera suresh bandara herath18-Sep-23 4:04
sameera suresh bandara herath18-Sep-23 4:04 
AnswerRe: FIREBASE Filter Data from Date to Date Pin
OriginalGriff18-Sep-23 5:05
mveOriginalGriff18-Sep-23 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.