public async Task <IActionResult> Update([FromBody] UpdateTicketModel model) { var userToUpdate = _queryBus.RequestAsync <TicketByIdQuery, TicketByIdResponse>(new TicketByIdQuery { TicketId = model.Id }); if (userToUpdate == null || model == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest()); } var command = new UpdateTicketCommand { Id = model.Id, FlightNumber = model.FlightNumber, Price = model.Price }; await _commandBus.ExecuteAsync(command); return(Ok()); }
public void UpdateTicket(int id, TicketUpdateModel model) { var cmd = new UpdateTicketCommand(id, model.Title, model.Description, model.Status, model.Priority, model.Type, model.DueDate, model.ResolutionComments, model.AssignedToLoginName, model.Category); _bus.Send(cmd); }
public async Task <IActionResult> UpdateTicket([FromBody] UpdateTicketCommand ticket) { var result = await Mediator.Send(ticket); return(result.Successful == true?Ok(result) : BadRequest(result.Exception.InnerException.Message ?? result.Exception.Message)); }
public async Task <ActionResult <int> > Update(UpdateTicketCommand command) { return(await Mediator.Send(command)); }