コード例 #1
0
        public async Task <IActionResult> UpdateFileAsync([FromBody] UpdateFileCommand command)
        {
            command.UserId = UserId;
            await CommandDispatcher.DispatchAsync(command);

            return(Ok());
        }
コード例 #2
0
 public async Task <Unit> UpdateFile(UpdateFileCommand file)
 {
     return(await Mediator.Send(new UpdateFileCommand()
     {
         CorrelativoArchivos = file.CorrelativoArchivos, Descripcion = file.Descripcion
     }));
 }
コード例 #3
0
        public async Task <IActionResult> UpdateTags([FromBody] UpdateFileCommand command)
        {
            var result = await Mediator.Send(command);

            if (result.IsSuccess)
            {
                return(Ok());
            }

            return(BadRequest(_sharedLocalizer[result.FailureReason].Value));
        }
コード例 #4
0
        public async Task <ActionResult> Update(int id, UpdateFileCommand command)
        {
            if (id != command.Id)
            {
                return(BadRequest());
            }

            await Mediator.Send(command);

            return(NoContent());
        }
コード例 #5
0
        public void Update(UpdateFileCommand command)
        {
            AssertConcern.AssertArgumentNotGuidEmpty(command.FileId, "Identificador do arquivo inválido");

            var file = FileRepository.GetById(command.FileId);

            AssertConcern.AssertArgumentNotNull(file, "Arquivo não encontrado");

            file.Name        = command.FileName;
            file.ContentType = command.ContentType;
            file.ReferenceId = command.ReferenceId.Value;
            file.Size        = command.File.Length;

            FileRepository.Update(file, command.UpdateUser);
            AzureContainer.AddFile($"{file.Id}_{file.Name}", command.File);

            Uow.Commit();
        }
コード例 #6
0
ファイル: APITests.cs プロジェクト: mbuchcik/easynotewpf
        public void should_update_note()
        {
            var allNotes = service.Get();
            var note = allNotes.First();

            var command = new UpdateFileCommand
            {
                Id = note.Id,
                Author = note.Author,
                Content = note.Content + Environment.NewLine + DateTime.Now.Ticks,
                Name = note.Name
            };

            service.Update(command);

            var updatedNote = service.Get(note.Id);

            Assert.AreEqual(command.Content, updatedNote.Content);
        }
コード例 #7
0
ファイル: Session.cs プロジェクト: 206039/FileEditorApp
        private async Task SaveChanges()
        {
            if (SingleFileDto.Id == 0)
            {
                return;
            }
            if (SingleFileDto.Filename.IsNullOrEmpty())
            {
                return;
            }
            var updateFileCommand = new UpdateFileCommand {
                Content = SingleFileDto.Content, Filename = SingleFileDto.Filename, Id = SingleFileDto.Id
            };

            if ((await RestService.Execute <SuccessEvent>(HttpMethod.Put, "files", updateFileCommand, FileEditorAppContext.LoggedUser.JwtToken)) is SuccessEvent @event)
            {
                SingleFileDto = new SingleFileDto {
                    Content = "", Id = 0, Filename = ""
                };
                await OnInitializedAsync();
            }
        }
コード例 #8
0
 public void Update(UpdateFileCommand command)
 {
     gateway.ExecuteAPICommand("files/update",
                               Method.PUT, command, HttpStatusCode.OK, logonInfo.authToken);
 }