public async Task <Invitation> Add(Invitation invitation)
        {
            var dbInvitation = new Entities.Invitation
            {
                GuestId   = invitation.Guest.Id,
                BandId    = invitation.Band.Id,
                HandlerId = invitation.Handler.Id
            };

            await dbContext
            .Set <Entities.Invitation>()
            .AddAsync(dbInvitation);

            await dbContext.SaveChangesAsync();

            return(Invitation.Create(dbInvitation.Id, invitation.Guest, invitation.Band, invitation.Handler));
        }
예제 #2
0
        /// <summary>
        /// This will create an invitation used notification.
        /// </summary>
        public void SendInvitationUsedNotification(Entities.Invitation invite)
        {
            var invUsedNType = NotificationsController.Instance.GetNotificationType(Constants.NOTIFICATION_INVITATIONUSED);

            var invitedUser = UserController.GetUserById(invite.PortalId, invite.InvitedByUserId);

            if (invUsedNType != null && invitedUser != null)
            {
                Notification msg = new Notification
                {
                    NotificationTypeID = invUsedNType.NotificationTypeId,
                    To      = invitedUser.DisplayName,
                    Subject = "Your invited guest has joined!",
                    Body    = String.Format("{0} {1} has joined the community that you invited! You can now friend this user to add them to your inner circle.", invite.RecipientUser.FirstName, invite.RecipientUser.LastName),
                    IncludeDismissAction = true,
                    Context = invite.InviteId.ToString()
                };

                List <UserInfo> sendUsers = new List <UserInfo>();
                sendUsers.Add(invitedUser);

                NotificationsController.Instance.SendNotification(msg, invite.PortalId, null, sendUsers);
            }
        }