I am using MVC5 - Entity Framework 6 application. In my project, I have a model MasterOrderStatus
with two columns.
StatusId StatusName
1 New
2 Accepted
3 Completed
4 Cancelled
I have another model Orders
with the following
OrderID OrderStatus CustomerId Total
1 2 31 430.00
I have to keep the order status history in another table for every order when the status getting changed. Also each record should be with previous status and current status of order. Model OrdersHistory
would be like the following
OrderHistoryId OrderId PrevStats CurrentStats Comments
1 1 [null] 1 ...
2 1 1 2 ...
How to set & get the StatusId
from MasterOrderStats
foriegn key to both PrevStats
and CurrentStats
field to show order history with Status names.
Thanks in Advance.