public async Task <IHttpActionResult> createKnowledge()
        {
            byte[] _file  = null;
            var    result = new List <QuestionAnswerModel>();
            CreateKnowledgeModel model = new CreateKnowledgeModel
            {
                NombreResponsable  = Convert.ToString(HttpContext.Current.Request["NombreResponsable"]),
                Apellidos          = Convert.ToString(HttpContext.Current.Request["Apellidos"]),
                Telefono           = Convert.ToString(HttpContext.Current.Request["Telefono"]),
                Email              = Convert.ToString(HttpContext.Current.Request["Email"]),
                NombreConocimiento = Convert.ToString(HttpContext.Current.Request["NombreConocimiento"])
            };
            //Obtiene el archivo excel
            var files = HttpContext.Current.Request.Files;

            if (files.Count > 0)
            {
                for (int i = 0; i < files.Count; i++)
                {
                    var file = files[i];

                    DataTable _table = null;

                    BinaryReader reader = new BinaryReader(files[i].InputStream);  //FileUpload1.PostedFile.InputStream)
                    _file = reader.ReadBytes(files[i].ContentLength);

                    _table = ConvertToDataTale(files[i].InputStream);
                    //DataTable _DataReader = ByteBufferToTable(_file, true);

                    try
                    {
                        result = await services.SaveAnswerKnowledge(_table, model);
                    }
                    catch (Exception ex) {
                        return(Ok(ex.Message.ToString()));
                    }
                }
            }
            else
            {
                return(BadRequest("Nodata"));
            }
            return(Ok(result));
        }
        public async Task <List <QuestionAnswerModel> > SaveAnswerKnowledge(DataTable _dTable, CreateKnowledgeModel model)
        {
            var questionAnswerModel = new List <QuestionAnswerModel>();

            try
            {
                using (var _dbContext = new DataBaseContext())
                {
                    object[] parameters = new object[] { model.NombreResponsable, model.Apellidos, model.Telefono, model.Email, model.NombreConocimiento, _dTable };
                    var      _result    = await _dbContext.ExecuteReaderAsync("sp_CreateKnowledgeBase", parameters);

                    while (_result.Read())
                    {
                        questionAnswerModel.Add(new QuestionAnswerModel()
                        {
                            id        = 0,
                            answer    = _result[1].ToString(),
                            source    = "Editorial",
                            questions = _result[0].ToString().Split(';'),
                            metadata  = new string[0]
                        });
                    }
                }
            }
            catch (Exception) {
                questionAnswerModel = new List <QuestionAnswerModel>();
            }
            return(questionAnswerModel);
        }