本文整理汇总了C#中INotificationService.NotifyNewEntityRequest方法的典型用法代码示例。如果您正苦于以下问题:C# INotificationService.NotifyNewEntityRequest方法的具体用法?C# INotificationService.NotifyNewEntityRequest怎么用?C# INotificationService.NotifyNewEntityRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INotificationService
的用法示例。
在下文中一共展示了INotificationService.NotifyNewEntityRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryAuthenticateFromHttpContext
protected async Task<LiveLoginResult> TryAuthenticateFromHttpContext(ICommunityService communityService, INotificationService notificationService)
{
var svc = new LiveIdAuth();
var result = await svc.Authenticate();
if (result.Status == LiveConnectSessionStatus.Connected)
{
var client = new LiveConnectClient(result.Session);
SessionWrapper.Set("LiveConnectClient", client);
SessionWrapper.Set("LiveConnectResult", result);
SessionWrapper.Set("LiveAuthSvc", svc);
var getResult = await client.GetAsync("me");
var jsonResult = getResult.Result as dynamic;
var profileDetails = ProfileService.GetProfile(jsonResult.id);
if (profileDetails == null)
{
profileDetails = new ProfileDetails(jsonResult);
// While creating the user, IsSubscribed to be true always.
profileDetails.IsSubscribed = true;
// When creating the user, by default the user type will be of regular.
profileDetails.UserType = UserTypes.Regular;
profileDetails.ID = ProfileService.CreateProfile(profileDetails);
// This will used as the default community when user is uploading a new content.
// This community will need to have the following details:
var communityDetails = new CommunityDetails
{
CommunityType = CommunityTypes.User, // 1. This community type should be User
CreatedByID = profileDetails.ID, // 2. CreatedBy will be the new USER.
IsFeatured = false, // 3. This community is not featured.
Name = Resources.UserCommunityName, // 4. Name should be NONE.
AccessTypeID = (int) AccessType.Private, // 5. Access type should be private.
CategoryID = (int) CategoryType.GeneralInterest
// 6. Set the category ID of general interest. We need to set the Category ID as it is a foreign key and cannot be null.
};
// 7. Create the community
communityService.CreateCommunity(communityDetails);
// Send New user notification.
notificationService.NotifyNewEntityRequest(profileDetails,
HttpContext.Request.Url.GetServerLink());
}
SessionWrapper.Set<long>("CurrentUserID", profileDetails.ID);
SessionWrapper.Set<string>("CurrentUserProfileName",
profileDetails.FirstName + " " + profileDetails.LastName);
SessionWrapper.Set("ProfileDetails", profileDetails);
SessionWrapper.Set("AuthenticationToken", result.Session.AuthenticationToken);
}
return result;
}