public async Task <ActionResult> Index(Order order) { //Request is an extension method in the NServiceBus.Callbacks NuGet package //You also need to assign a unique id to the endpoint var priceResponse = await endpoint.Request <PriceResponse>(new PriceRequest { Weight = order.Weight }); order.Price = priceResponse.Price; return(View("Review", order)); }
public async Task <ActionResult> Confirm(Order order) { await endpoint.Send("FireOnWheels.Order", new ProcessOrderCommand { AddressFrom = order.AddressFrom, AddressTo = order.AddressTo, Price = order.Price, Weight = order.Weight }).ConfigureAwait(false); return(View()); }
public ActionResult Confirm(Order order) { ServiceBus.Bus.Send("fireonwheels.order", new ProcessOrderCommand { AddressFrom = order.AddressFrom, AddressTo = order.AddressTo, Price = order.Price, Weight = order.Weight }); return(View()); }
public ActionResult Confirm(Order order) { ServiceBus.Bus.Send(new ProcessOrderCommand { OrderId = Guid.NewGuid(), AddressFrom = order.AddressFrom, AddressTo = order.AddressTo, Price = order.Price, Weight = order.Weight }); return(View()); }
public async Task <ActionResult> Index(Order order) { var options = new SendOptions(); options.SetDestination("FireOnWheels.Order"); //Request is an extension method in the NServiceBus.Callbacks NuGet package //You also need to assign a unique id to the endpoint var priceResponse = await endpoint.Request <PriceResponse>(new PriceRequest { Weight = order.Weight }, options); order.Price = priceResponse.Price; return(View("Review", order)); }
public async Task <ActionResult> Confirm(Order order) { await endpoint.Send(new ProcessOrderCommand { OrderId = Guid.NewGuid(), AddressFrom = order.AddressFrom, AddressTo = order.AddressTo, Price = order.Price, Weight = order.Weight }).ConfigureAwait(false); return(View()); }
public ActionResult Index(Order order) { var callback = ServiceBus.Bus.Send(new PriceRequest { Weight = order.Weight }) .Register(result => { var localResult = (CompletionResult)result.AsyncState; var reply = (PriceResponse)localResult.Messages[0]; order.Price = reply.Price; }, null); callback.AsyncWaitHandle.WaitOne(); return(View("Review", order)); }
public ActionResult Index(Order order) { order.Price = PriceCalculator.GetPrice(order); return(View("Review", order)); }