Пример #1
0
 public IHttpActionResult AddQuestion([FromBody] QuestionDTO question)
 {
     try
     {
         return(Ok(QuestionLogic.AddQuestion(question)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
        public WebResult AddQuestion([FromBody] JObject obj)
        {
            QuestionDTO      question = obj["ques"].ToObject <QuestionDTO>();
            List <AnswerDTO> answers  = obj["ans"].ToObject <List <AnswerDTO> >();
            WebResult        wr       = new WebResult();

            try
            {
                wr.value   = QuestionLogic.AddQuestion(question, answers);
                wr.message = "success";
                wr.status  = true;
                return(wr);
            }
            catch (Exception ex)
            {
                wr.status  = false;
                wr.message = ex.Message;
                return(wr);
            }
        }