Hi, @Htet Lin ,
You could try the approch below:
- Define your model with updated_by and updated_at properties.
- Before updating, Check whether the update time from the posted value is later than the updateAt in DB or not. If late, return failed.
- If failed, show a pop-up message to reload data again.
Example:
public class Product {
public int Id { get; set; }
public string Name { get; set; }
public string UpdatedBy { get; set; }
public DateTime UpdatedAt { get; set; }
}
Eachtime the views display the Product will contain these two properties.
Product
Id = 1,
Name = "abc",
UpdatedBy= "admin"
UpdatedAt ="12/19/2020 12:00:00"
---
User2 updated the Product { Id = 1, Name = "xyz", UpdatedBy= "user2", UpdatedAt ="12/19/2020 12:00:00" } Success
Product in DB
Id = 1,
Name = "xyz",
UpdatedBy= "user2"
UpdatedAt ="12/19/2020 12:10:00"
---
If User1 submit Product { Id = 1, Name = "efg", UpdatedBy= "user1", UpdatedAt ="12/19/2020 12:00:00" }, it will be failed.
If the answer doesn’t solve your issue, please provide more details of error that will help us track down what’s happening.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Michael Wang