Exemple #1
0
        public async Task <ActionResult> Import_Partial(ImportModel model)
        {
            model.Update(Module, this);
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            // Download the zip file
            FileUpload upload   = new FileUpload();
            string     tempName = await upload.StoreTempPackageFileAsync(model.RemoteFile);

            // import it
            List <string> errorList = new List <string>();
            bool          success   = await Package.ImportAsync(tempName, errorList);

            // delete the temp file just uploaded
            await FileSystem.TempFileSystemProvider.DeleteFileAsync(tempName);

            string msg = FormatMessage(success, errorList, model.RemoteFile);

            if (success)
            {
                model.RemoteFile = null;
                return(FormProcessed(model, msg));
            }
            else
            {
                // Anything else is a failure
                return(FormProcessed(model, msg));
            }
        }
Exemple #2
0
        public ActionResult Import()
        {
            ImportModel model = new ImportModel  {
            };

            model.Update(Module, this);
            return(View(model));
        }