public async Task <ActionResult> Update(long id, UpdateListingCommand command) { if (id != command.Id) { return(BadRequest()); } await Mediator.Send(command); return(NoContent()); }
public async Task <ActionResult> UpdateListingAsync(long listingId, [FromBody] UpdateListingCommand command) { if (ModelState.IsValid) { command.ListingId = listingId; await pipelineService.HandleCommandAsync(command); return(Ok()); } else { return(BadRequest()); } }
/// <summary> /// Update listing command handler async. /// </summary> /// <param name="listingCommand">Update listing command.</param> /// <param name="listingRepository">Listing repository.</param> public async Task HandleUpdateListingAsync(UpdateListingCommand listingCommand) { listingCommand.UpdateListingInfo = mapper.Map <ListingDto>(listingCommand); await listingRepository.UpdateListingAsync(listingCommand.ListingId, listingCommand.UpdateListingInfo); }
public async Task <IActionResult> PostUpdateListingAsync([FromBody] UpdateListingCommand updateListingCommand) => Ok(new { result = await _mediator.Send(updateListingCommand) });