Beispiel #1
0
        public string saveMessage(string json)
        {
            JObject jobject = JObject.Parse(json);
            JToken  form    = jobject["message"];

            DateTime dt = DateTime.Now;

            DateTime.TryParse(form["DateCreated"].ToString(), out dt);
            int uid = -1;

            int.TryParse(form["UID"].ToString(), out uid);
            MessagesModel mm = new MessagesModel()
            {
                MessageTitle       = form["MessageTitle"].ToString(),
                DateCreated        = dt,
                MessageDescription = form["MessageDescription"].ToString(),
                MessageAuthor      = form["MessageAuthor"].ToString(),
                MessageHardCopy    = form["MessageHardCopy"].ToString(),
                Series             = form["Series"].ToString(),
                VideoFile          = form["VideoFile"].ToString(),
                mp3File            = form["mp3File"].ToString(),
                UID = uid
            };

            MessagesModel mm2        = new MessagesRepository().SaveMessage(mm);
            string        returnjson = new JavaScriptSerializer().Serialize(mm2);

            return(returnjson);
        }
Beispiel #2
0
        string GetMessagesInSeriesFromDB(string seriesName)
        {
            List <MessagesModel> msgs = new MessagesRepository().GetMessagesInSeries(seriesName);
            string returnjson         = new JavaScriptSerializer().Serialize(msgs);

            return(returnjson);
        }
        public string GetListsOfMessagesFromDB()
        {
            List <MessagesModel> msgs = new MessagesRepository().GetListOfMessages();
            string returnjson         = new JavaScriptSerializer().Serialize(msgs);

            return(returnjson);
        }