Exemplo n.º 1
0
        public async Task <IActionResult> UpdateFileAsync([FromBody] UpdateFileCommand command)
        {
            command.UserId = UserId;
            await CommandDispatcher.DispatchAsync(command);

            return(Ok());
        }
Exemplo n.º 2
0
 public async Task <Unit> UpdateFile(UpdateFileCommand file)
 {
     return(await Mediator.Send(new UpdateFileCommand()
     {
         CorrelativoArchivos = file.CorrelativoArchivos, Descripcion = file.Descripcion
     }));
 }
        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));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Update(int id, UpdateFileCommand command)
        {
            if (id != command.Id)
            {
                return(BadRequest());
            }

            await Mediator.Send(command);

            return(NoContent());
        }
Exemplo n.º 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();
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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();
            }
        }
Exemplo n.º 8
0
 public void Update(UpdateFileCommand command)
 {
     gateway.ExecuteAPICommand("files/update",
                               Method.PUT, command, HttpStatusCode.OK, logonInfo.authToken);
 }