Esempio n. 1
0
        static void Main(string[] args)
        {
            JokesDatabase jdb = new JokesDatabase();


            //Try the create method
            //Joke j = new Joke() { title = "Postcard", jokeText = "My wife told me: ‘Sex is better on holiday.’ That wasn’t a very nice postcard to receive." };
            //jdb.AddJoke(j);

            List <Joke> l = jdb.GetAllJokes();

            foreach (Joke jo in l)
            {
                Console.WriteLine($"Joke ID : {jo.JokeId }, Title : { jo.Title }, Joke : { jo.JokeText }");
            }

            Joke jok = jdb.GetJoke(4);

            Console.WriteLine($"Joke ID : {jok.JokeId }, Title : { jok.Title }, Joke : { jok.JokeText }");
        }
Esempio n. 2
0
 // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
 // To create an operation that returns XML,
 //     add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
 //     and include the following line in the operation body:
 //         WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
 public List <Joke> GetAllJokes()
 {
     // Add your operation implementation here
     return(jd.GetAllJokes());
 }
Esempio n. 3
0
        public List <Joke> GetAllJokes()
        {
            List <Joke> jokeList = jd.GetAllJokes();

            return(jokeList);
        }