コード例 #1
0
 /// <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();
 }
コード例 #2
0
        /// <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);
        }