private HttpRequestMessage CreateDeleteRequest(RemoveBookPhotoCommand command)
        {
            var request = new HttpRequestMessage(HttpMethod.Delete, "/api/file");

            request.Content = new StringContent(JsonConvert.SerializeObject(command), Encoding.UTF8, "application/json");
            return(request);
        }
Exemplo n.º 2
0
        public async Task <Response <bool> > Handle(RemoveBookPhotoCommand request, CancellationToken cancellationToken)
        {
            var photo = await photoRepo.GetPhotoByIdAsync(request.PhotoId);

            await photoRepo.Remove(photo);

            return(Response.Ok());
        }
        public async Task RemoveBookPhoto_returnResponseBook(string bookId, string PhotoId)
        {
            await AuthenticateMeBabyAsync();

            var command = new RemoveBookPhotoCommand()
            {
                BookId  = bookId,
                PhotoId = PhotoId
            };
            var request  = CreateDeleteRequest(command);
            var response = await Client.SendAsync(request);

            var content = await request.Content.ReadAsAsync <Response <bool> >();

            content.Item.Should().Be(true);
        }
 public async Task <Response <bool> > BookPhoto([FromBody] RemoveBookPhotoCommand command)
 {
     return(await mediator.Send(command));
 }