Пример #1
0
        public async Task UpdateAsync(FileTemplateInputDto dto)
        {
            var fileTemplate = await _printRepo.GetAsync(dto.Id);

            var fileInfo = new FileInfo(Path.Combine(_templatesPath, fileTemplate.Path));

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
            }
            await _printRepo.UpdateAsync(dto.MapTo <FileTemplate>());
        }
Пример #2
0
        public async Task <AjaxResult> Update(FileTemplateInputDto dto)
        {
            return(await AjaxResult.Business(async result =>
            {
                Check.NotNull(dto, nameof(dto));
                dto.DateTime = DateTime.Now;
                if (!ModelState.IsValid)
                {
                    result.Error("提交信息验证失败");
                    return;
                }

                await _fileContract.UpdateAsync(dto);
                result.Success();
            }));
        }
Пример #3
0
 public async Task AddAsync(FileTemplateInputDto dto)
 {
     await _printRepo.InsertAsync(dto.MapTo <FileTemplate>());
 }