public async Task <ActionResult> UpdateItemDetails(int id, UpdateTourPackageDetailCommand command) { if (id != command.Id) { return(BadRequest()); } await Mediator.Send(command); return(NoContent()); }
public async Task ShouldUpdateTourPackage() { var listId = await SendAsync(new CreateTourListCommand { City = "Zagreb", Country = "Croatia", About = "Lorem Ipsum" }); var packageId = await SendAsync(new CreateTourPackageCommand { ListId = listId, Name = "Free Walking Tour Zagreb", Duration = 2, Price = 10, InstantConfirmation = true, MapLocation = "Lorem Ipsum", WhatToExpect = "Lorem Ipsum" }); var command = new UpdateTourPackageDetailCommand { Id = packageId, ListId = listId, Duration = 3, Price = 20, InstantConfirmation = false, MapLocation = "Lorem Ipsum", WhatToExpect = "Lorem Ipsum" }; await SendAsync(command); var item = await FindAsync <TourPackage>(packageId); item.ListId.Should().Be(command.ListId); item.Duration.Should().Be(command.Duration); item.Price.Should().Be(command.Price); item.InstantConfirmation.Should().Be(command.InstantConfirmation); item.MapLocation.Should().Be(command.MapLocation); item.WhatToExpect.Should().Be(command.WhatToExpect); }