Exemple #1
0
        public ActionResult CreateIndex(IndexModel mod, HttpPostedFileBase path)
        {
            string t  = Convert.ToString(path);
            int    ls = t.LastIndexOf('.');
            int    l  = t.Length;

            t = t.Remove(ls, l - ls);
            t = t.Replace("\"", ".");
            int lss = t.LastIndexOf('.');

            t        = t.Remove(lss, l - lss);
            t        = t.Replace(".", "\"");
            mod.path = t;
            DtCrud d      = new DtCrud();
            var    result = d.CreateIndex(mod.indexname, mod.path);

            return(View());
        }
        public IHttpActionResult createindex(IndexModel mod)
        {
            if (mod.path.Contains("fakepath"))
            {
                string[] str = Directory.GetFiles(@"D:\schools");
                mod.path = str[0];
            }
            string t  = mod.path;
            int    ls = t.LastIndexOf('.');
            int    l  = t.Length;

            t = t.Remove(ls, l - ls);
            t = t.Replace("\\", ".");
            int lss = t.LastIndexOf('.');

            l = t.Length;
            t = t.Remove(lss, l - lss);
            t = t.Replace(".", "\\");
            var result = repo.CreateIndex(mod.indexname, t);

            return(Ok(result));
        }