only allow 1 user to update data at a time on web application

I built a mvc 5 web application (.net framework and sql server database).  I have a design question.  Some users are in an office and some have laptops in car.  How can I make sure that users don't overwrite another user's modifications on a page?  user1 edits a record, and user2 tries to edit the same record before user1 has saved the changes.  Any guidance appreciated.
dan hendersonAsked:
Who is Participating?
 
Nakul VachhrajaniConnect With a Mentor Technical Architect, Capgemini IndiaCommented:
I guess what you are looking for is Optimistic Concurrency: https://nakulvachhrajani.com/2010/12/21/optimistic-concurrency-a-conceptual-introduction/
0
 
Brian CroweDatabase AdministratorCommented:
I would recommend adding schema to indicate that the object is "checked out" for editing.  You can do this on a single table or create a separate table that has a source object and key value that includes the CheckOutDate and CheckedOutByUserID.  This would provide transparency and potentially the ability to override or void another user's subscription based on user roles.  Obviously this will significantly impact your entire solution to implement.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.