예제 #1
0
        public virtual ActionResult Import(ImportRepositoryModel model, string @return)
        {
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                Kooboo.CMS.Content.Models.Repository repository = null;
                if (Request.Files.Count > 0)
                {
                    repository = Kooboo.CMS.Content.Services.ServiceFactory.RepositoryManager.Create(model.Name, Request.Files[0].InputStream);
                }
                else
                {
                    repository = Kooboo.CMS.Content.Services.ServiceFactory.RepositoryManager.Create(model.Name, model.File);
                }

                resultData.RedirectUrl = @return;
            });

            return Json(data, "text/plain", System.Text.Encoding.UTF8);
        }
예제 #2
0
 public virtual ActionResult Import(ImportRepositoryModel model, string @return)
 {
     var data = new JsonResultData(ModelState);
     if (ModelState.IsValid)
     {
         data.RunWithTry((resultData) =>
         {
             Manager.Create(model.Name, model.File.InputStream);
             data.RedirectUrl = @return;
         });
     }
     return Json(data, "text/plain", System.Text.Encoding.UTF8);
 }