Exemplo n.º 1
0
        /// <summary>
        /// gets all info required to post a song
        /// </summary>
        /// <returns>success/failure message</returns>
        private static Assignment2.song getSongPostInfo()
        {
            Assignment2.song s = new Assignment2.song();
            Console.WriteLine("");
            Console.WriteLine("Input song Id:");
            s.id = Decimal.Parse(Console.ReadLine());
            Console.WriteLine("Input song name:");
            s.songName = Console.ReadLine();
            Console.WriteLine("Input artist name:");
            s.artistName = Console.ReadLine();
            Console.WriteLine("Input year published:");
            s.yearPublished = int.Parse(Console.ReadLine());

            return(s);
        }
Exemplo n.º 2
0
 /// <summary>
 /// does the pot action for the table specified
 /// </summary>
 /// <param name="table">the table(API)</param>
 private static void postAPICall(string table)
 {
     if (table.Equals("songs"))
     {
         Assignment2.song s      = getSongPostInfo();
         SongsController  cont   = new SongsController();
         string           result = cont.PostSong(s);
         Console.WriteLine(result);
     }
     else if (table.Equals("reviews"))
     {
         Assignment2.review r      = getReviewPostInfo();
         ReviewsController  cont   = new ReviewsController();
         string             result = cont.PostReview(r);
         Console.WriteLine(result);
     }
 }