public HttpResponseMessage RunFile(UpdateFileDTO submitted)
        {
            try
            {
                string realfilename = HostingEnvironment.MapPath(submitted.Filename);

                File.WriteAllText(realfilename, submitted.Content);

                Dictionary <string, string> parameters = new Dictionary <string, string>();
                string dsFileName = Path.ChangeExtension(realfilename, ".datasource");
                if (File.Exists(dsFileName))
                {
                    string[] lines = File.ReadAllLines(dsFileName);
                    foreach (var item in lines)
                    {
                        string[] par = item.Split('=');
                        parameters.Add(par[0], par[1]);
                    }
                }
                parameters.Add("templatefile", submitted.Filename);
                string Output = WidgetTokenProvider.ExecuteWidget(parameters);

                return(Request.CreateResponse(HttpStatusCode.OK, Output));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, ex.Message));
            }
        }
        public HttpResponseMessage UpdateFile(UpdateFileDTO submitted)
        {
            string realfilename = HostingEnvironment.MapPath(submitted.Filename);

            File.WriteAllText(realfilename, submitted.Content);
            return(Request.CreateResponse(HttpStatusCode.OK, realfilename));
        }
Example #3
0
        public async Task <Guid> UpdateAsync(UpdateFileDTO updateFile)
        {
            await _imageFileSystem.TryUpdateAsync(updateFile);

            await _imageRepositorySystem.TryUpdateAsync(updateFile);

            return(updateFile.NewFile.Id);
        }
Example #4
0
        public async Task TryUpdateAsync(UpdateFileDTO updateFile)
        {
            if (updateFile == null)
            {
                return;
            }

            await DeleteAsync(updateFile.OldFile.Id, updateFile.FilePath);
            await TrySaveAsync((ImageEntity)updateFile.NewFile, updateFile.FilePath);
        }
Example #5
0
        public async Task <Guid> TryUpdateAsync(UpdateFileDTO updateFile)
        {
            if (updateFile.NewFile == null)
            {
                return(updateFile.OldFile.Id);
            }

            await TryDeleteAsync(updateFile.OldFile.Id);
            await TrySaveAsync(updateFile.NewFile as ImageEntity);

            return(updateFile.NewFile.Id);
        }
Example #6
0
        public async Task <ActionResult> UpdateFile(int id, UpdateFileDTO updateFile)
        {
            var oldFile = _fileService.Load(id);

            if (oldFile == null)
            {
                return(NotFound(new { message = "File not found" }));
            }

            if (!string.IsNullOrEmpty(updateFile.OriginalName))
            {
                oldFile.OriginalName = updateFile.OriginalName;
            }

            var updatedId = await _fileService.Update(id, oldFile);

            return(Ok(updatedId));
        }
        public HttpResponseMessage DataFile(UpdateFileDTO submitted)
        {
            string realfilename = HostingEnvironment.MapPath(submitted.Filename);
            File.WriteAllText(realfilename, submitted.Content);

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            string dsFileName = Path.ChangeExtension(realfilename, ".datasource");
            string[] lines = File.ReadAllLines(dsFileName);
            foreach (var item in lines)
            {
                string[] par = item.Split('=');
                parameters.Add(par[0], par[1]);
            }
            //parameters.Add("templatefile", dfeTree.TreeView.SelectedValue);

            string Output = WidgetTokenProvider.ExecuteWidget(parameters);

            return Request.CreateResponse(HttpStatusCode.OK, Output);
        }
 public HttpResponseMessage UpdateFile(UpdateFileDTO submitted)
 {
     string realfilename = HostingEnvironment.MapPath(submitted.Filename);
     File.WriteAllText(realfilename, submitted.Content);
     return Request.CreateResponse(HttpStatusCode.OK, realfilename);
 }