예제 #1
0
 public string Answer([FromBody] AnswerRequest req)
 {
     if (req.AnswerId == 0)
     {
         var md       = Markdown.Encode(req.Answer);
         var htmlBody = Markdown.Encode(req.Answer);
         ContentApi.InsertAsChild(req.QuestionId, new Content()
         {
             Type = "answer", Body = req.Answer, UserId = 1, HtmlBody = htmlBody
         });
         return(md);
     }
     else
     {
         var md = Markdown.Encode(req.Answer);
         ContentApi.Update(req.AnswerId, null, req.Answer, md);
         return(md);
     }
 }