I am using Entity framework and I have Users, Events and a table UsersEvents. I know to this questions I probably can find on google, and I already tried but somehow, still have problems.
So I have:
User: UserId, Name
Event: EventId, Title
UserEvents: UserId, EventId
I want to create Event.
So on my Repository I have a method:
public void CreateEvent(Event @event)
{
//How to add event? (so the database will update the user that created the
//event and also will update the UsersEvents table.
}
I have tried to add the event first, but then had a problem to get the user. Can someone help me and even without a code, just to help me understand how should I do this. Should I add the event and then the user? or should I add the event and the user to the UsersEvents? Thanks in advance :)