After doing some investigation* I have learned that I could potentially have a concurrency problem.
I'm currently building a Tournament Platform in ASP.NET MVC 5 with Entity Framework 6. So far, I've never had concurrency problems (Mostly because they fell into the overly-optimistic scenario). I ask money for people to enter (through PayPal) in some tournaments which are limited in quantity (say max. 32 players). What would happen if 50 people at the same time would try to enter the tournament?
So this presents a situation very similar to the "single quantity" or "shopping system cart problem with stock" links that I refer above. Unfortunately none of them actually come up with actual answers. Nonetheless, I have the advantage that the user must pay beforehand "to put the product in the basket". This means that there is no way of "reserving" or "gathering" the "product" before actually paying for it.
So far, what I'm thinking on doing is the following: The user clicks for registering into the site. It checks if there max capacity has not been reached. Then, it creates a "temporary placeholder" for the user to process the payment. So when others check, it will check both: the users who are currently registered and the ones in the temporary placeholder.
But there could be a flaw in my way of thinking:
1st) What if,in the moment the user is about to enter, the limit was not hit, but 10 seconds later, when he is about to commit his purchase, the max players number has been reached?
I could check exactly before the payment is sent, but what if there are many users doing the same thing? ...
I could order them through a timestamp and "sort-them-out" in a ordering and only select the first 32... would that work?
*
Integrating with a payment provider; Proper and robust OOP approach
How do I handle online payment for items with single quantity?
Optimistic Concurrency: Overview
shopping system cart problem with stock
How do I verify if 3rd party payment succeeded?
http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application
http://www.agiledata.org/essays/concurrencyControl.html