Reputation: 246
We are developing an iPhone app (for shopping) and have a dotnet application which takes the request coming from the iphone and processes them.
//How it works
return a message to iPhone whether transaction is successful or not
//How it has to work
iPhone sends the payment details to dotnet application for processing.
//this part is already implemented
So I need to return a message even before the transaction is processed (to make it more user friendly and not to annoy them by the delay caused for the entire process). After the message is sent it should proceed to actual payment process. How can I do this?
Upvotes: 0
Views: 69
Reputation: 9034
Simply write your async codes like this :
public ActionResult ProcessPayment(PaymentModel model)
{
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
//do your payment processing here...
});
return view("success blob blob...");
}
Note : anyway your solution has no any fallback strategy. What will you do if you failed through payment process or mail sending process?! If you need a comprehensive solution, use SignalR
components (although it is more complex)
Upvotes: 1