/// <inheritdoc /> public void AddToRoom(int roomId, int userId, int adderId, MeetRole role = MeetRole.Guest) { this.DatabaseContext.Add(new RoomUser() { AdderId = adderId, RoomId = roomId, UserId = userId, Role = role }); this.DatabaseContext.SaveChanges(); }
/// <inheritdoc /> public void AddToRoom(int roomId, string usernameOrEmail, int adderId, MeetRole role = MeetRole.Guest) { usernameOrEmail = usernameOrEmail.ToUpperInvariant(); var user = this.DatabaseContext.Users.Where(u => u.NormalizedUserName.Equals(usernameOrEmail) || u.NormalizedEmail.Equals(usernameOrEmail)).SingleOrDefault(); if (user == null) { throw new System.ArgumentException("User cannot be found"); } this.AddToRoom(roomId, user.Id, adderId, role); }