public static GroupMember CreateGroupMember(Group group, Guid referenceId, GroupMemberStatusEnum status) { ApplicationDbContext db = new ApplicationDbContext(); GroupMember member = CreateGroupMember(db, group, referenceId, status); db.Dispose(); return(member); }
public static GroupMember CreateGroupMember(ApplicationDbContext db, Group group, Guid referenceId, GroupMemberStatusEnum status) { GroupMember member = new GroupMember() { GroupMemberId = Guid.NewGuid(), GroupId = group.GroupId, Type = group.Type, ReferenceId = referenceId, AddedBy = group.GroupOriginatorAppUserId, AddedDateTime = DateTime.Now, Status = status }; db.GroupMembers.Add(member); db.SaveChanges(); //Create ACTION if this is created with a waiting status - actions created dependent on group acceptancelevel UserActionHelpers.CreateActionForGroupMemberAccceptance(db, group, member); return(member); }