public void CreateProjectInvitation(Guid projectKey, string userName, string inviteCode, string userKey, string email, DateTime serverTime)
{
using (var context = GetDataContext())
{
var user = context.Users.SingleOrDefault(x => x.UserKey == userKey);
context.ProjectInvitations.InsertOnSubmit(new ProjectInvitation
{
ProjectId = context.Projects.Single(x => x.ProjectKey == projectKey).ProjectId,
InviteCode = inviteCode,
ServerCreateTime = serverTime,
UserEmail = email,
UserId = user?.UserId,
InviterUserId = context.Users.Single(x => x.UserName == userName).UserId,
});
context.SubmitChanges();
}
}