public string sendLastCommentFromIdLocation(string idLocation, string code)
 {
     List<Comments> comments = new List<Comments>();
     Comments lastComment = new Comments();
     Stream resultStream;
     byte[] result;
     string resultJson;
     List<string> listChar = new List<string>();
     SpeechSynthesizer speech = new SpeechSynthesizer("SmartAudioCityGuide", "Lz+vYpOFm6NTP83A9y0tPoX6ByJa06Q6yxHvoBsD0xo=");
     comments = commentServices.findCommentByIdLocation(Convert.ToInt32(idLocation));
     lastComment = comments.Last();
     resultStream = speech.GetSpeakStream(lastComment.description,"pt");
     result = convertStreamToByteBuffer(resultStream);
     for (int i = 0; i < result.Length; i++)
     {
         listChar.Add(result[i].ToString());
     }
     resultJson = javaSerializer.Serialize(listChar);
     return resultJson;
 }
        public ActionResult addTextComment(Comments comment,string selectList)
        {
            SpeechSynthesizer speech = new SpeechSynthesizer("SmartAudioCityGuide", "Lz+vYpOFm6NTP83A9y0tPoX6ByJa06Q6yxHvoBsD0xo=");
            Stream stream;
            byte[] bytes;
            comment.isText = false;

            if (selectList == "--Select One--")
            {
                return RedirectToAction("index", "Maps");
            }

            else if(selectList == "Normal Mode")
            {
                comment.typeOfCommentsId = 1;
            }

            else if (selectList == "Exploration Mode")
            {
                comment.typeOfCommentsId = 2;
            }

            stream = speech.GetSpeakStream(comment.description);
            bytes = ReadFully(stream);
            comment.sound = convertBytesToString(bytes);

            try
            {
                locationServices.addLocations(location.currentLocation);
                comment.locationsId = location.currentLocation.id;
                comment.userId = user.currentUser.id;
            }
            catch
            {

            }

            commentsServices.addComment(comment);

            return RedirectToAction("index", "Maps");
        }
        public string talkThis(string talk, string code)
        {
            Stream resultStream;
            byte[] result;
            string resultJson;
            List<string> listChar = new List<string>();
            SpeechSynthesizer speech = new SpeechSynthesizer("SmartAudioCityGuide", "Lz+vYpOFm6NTP83A9y0tPoX6ByJa06Q6yxHvoBsD0xo=");
            resultStream = speech.GetSpeakStream(talk);
            result = convertStreamToByteBuffer(resultStream);
            for (int i = 0; i < result.Length; i++)
            {
                listChar.Add(result[i].ToString());
            }
            resultJson = javaSerializer.Serialize(listChar);

            return resultJson;
        }
        public ActionResult editCommentWithId(int commentId , Comments comment, string selectList)
        {
            SpeechSynthesizer speech = new SpeechSynthesizer("SmartAudioCityGuide", "Lz+vYpOFm6NTP83A9y0tPoX6ByJa06Q6yxHvoBsD0xo=");
            Comments newComments = commentsServices.findCommentByIdComment(commentId);
            Stream stream;
            byte[] bytes;
            newComments.isText = false;

            if (selectList == "--Select One--")
            {
                return RedirectToAction("index", "Maps");
            }

            else if (selectList == "Normal Mode")
            {
                comment.typeOfCommentsId = 1;
            }

            else if (selectList == "Exploration Mode")
            {
                comment.typeOfCommentsId = 2;
            }

            stream = speech.GetSpeakStream(comment.description);
            bytes = ReadFully(stream);
            newComments.sound = convertBytesToString(bytes);
            newComments.typeOfCommentsId = comment.typeOfCommentsId;

            commentsServices.updateCommentForId(commentId, comment);

            return RedirectToAction("index", "Maps");
        }
        public ActionResult addTextCommentWithLocation(Comments comment ,int locationId)
        {
            SpeechSynthesizer speech = new SpeechSynthesizer("SmartAudioCityGuide", "Lz+vYpOFm6NTP83A9y0tPoX6ByJa06Q6yxHvoBsD0xo=");
            Stream stream;
            byte[] bytes;
            comment.isText = false;
            comment.locationsId = locationId;

            stream = speech.GetSpeakStream(comment.description);
            bytes = ReadFully(stream);
            comment.sound = convertBytesToString(bytes);

            try
            {
                comment.userId = user.currentUser.id;
            }
            catch
            {

            }

            commentsServices.addComment(comment);

            return RedirectToAction("index", "Maps");
        }