// To create record, first needs to create the instance of the object // A Post Call public object CreateResource(string containerName, string fullTypeName) { var joke = new Joke(); _service.AddJoke(joke); return(joke.Id); }
private static void ProcessInput(char keyPressed) { switch (keyPressed) { case 'L': { var ds = new JokeDataService(); var resultObject = ds.GetAllJokes(); foreach (Joke j in resultObject) { Console.WriteLine($"ID: {j.JokeId}"); Console.WriteLine($"Title: {j.Title}"); Console.WriteLine($"Joke: {j.JokeText}"); } break; } case 'N': { Joke j = new Joke(); Console.WriteLine("Title...."); j.Title = Console.ReadLine(); Console.WriteLine("Joke Text...."); j.JokeText = Console.ReadLine(); var ds = new JokeDataService(); var response = ds.AddJoke(j); Console.WriteLine("Joke Added:"); Console.WriteLine($"ID: {response.JokeId}"); Console.WriteLine($"Title: {response.Title}"); Console.WriteLine($"Joke: {response.JokeText}"); break; } } }
public void AddJoke(Joke joke) { _service.AddJoke(joke); }
public Joke AddJoke(Joke joke) { return(_service.AddJoke(joke)); }
public Joke Post(Joke joke) { Joke result = _service.AddJoke(joke); return(result); }