예제 #1
0
        /// <summary>
        /// gets all info required to post a review
        /// </summary>
        /// <returns>success/failure message</returns>
        private static Assignment2.review getReviewPostInfo()
        {
            Assignment2.review s = new Assignment2.review();
            Console.WriteLine("");
            Console.WriteLine("Input review Id:");
            s.reviewId = Decimal.Parse(Console.ReadLine());
            Console.WriteLine("Input song id:");
            s.songId = Decimal.Parse(Console.ReadLine());
            Console.WriteLine("Input rating(1-5):");
            s.rating = Decimal.Parse(Console.ReadLine());
            Console.WriteLine("Input text review:");
            s.review1 = Console.ReadLine();

            return(s);
        }
예제 #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);
     }
 }