Exemplo n.º 1
0
        private ActionResult ExecuteRequestPostOrPut(JObject body, int idParam)
        {
            if (body.HasValues &&
                body.ContainsKey("QuestionIntitule") &&
                body.ContainsKey("Answer"))
            {
                Question questionEnter   = MappingQuestion(idParam, body);
                bool     isQuestionExist = CheckIfQuestionExist(questionEnter);

                if (isQuestionExist == false)
                {
                    return(Ok(_questionRepository.AddOrUpdateQuestion(questionEnter)));
                }
                else
                {
                    return(BadRequest("La question existe déjà"));
                }
            }
            else
            {
                return(BadRequest());
            }
        }