예제 #1
0
        public string Post([FromBody] object value)
        {
            ResultObject result = new ResultObject();

            try
            {
                if (value != null)
                {
                    var question = JsonConvert.DeserializeObject <Question>(value.ToString());
                    result.Success = service.Insert(question);
                    return(JsonConvert.SerializeObject(result));
                }
                else
                {
                    result.Message = "Null content";
                    return(JsonConvert.SerializeObject(result));
                }
            }
            catch (Exception e)
            {
                result.Message = "EXCEPTION: " + e.Message + "Stack: " + e.StackTrace;
                return(JsonConvert.SerializeObject(result));
            }
            //  return JsonConvert.SerializeObject(result);
        }