示例#1
0
        // 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);
        }
示例#2
0
        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;
            }
            }
        }
示例#3
0
 public void AddJoke(Joke joke)
 {
     _service.AddJoke(joke);
 }
示例#4
0
 public Joke AddJoke(Joke joke)
 {
     return(_service.AddJoke(joke));
 }
示例#5
0
        public Joke Post(Joke joke)
        {
            Joke result = _service.AddJoke(joke);

            return(result);
        }