public async Task <IActionResult> CreateNewKnowledgeBase([FromForm] KnowledgeBaseCreateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var result = await _knowledgeBaseApiClient.PostKnowlegdeBase(request);

            if (result)
            {
                return(Ok());
            }
            return(BadRequest());
        }
Beispiel #2
0
        public async Task <IActionResult> CreateNewKnowledgeBase([FromForm] KnowledgeBaseCreateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (!Captcha.ValidateCaptchaCode(request.CaptchaCode, HttpContext))
            {
                ModelState.AddModelError("", "Mã xác nhận không đúng");
                return(BadRequest(ModelState));
            }

            var result = await _knowledgeBaseApiClient.PostKnowlegdeBase(request);

            if (result)
            {
                return(Ok());
            }
            return(BadRequest());
        }