public void CreateModeratorInvite(Channel channel, User inviter, User invited) { var now = DateTime.UtcNow; var moderatorNotification = new ModeratorNotificationModel { SenderName = inviter.FirstName, SenderAvatarUrl = inviter.AvatarUrl, ChannelName = channel.Name, ChannelId = channel.Id, Date = now.ToShortDateString(), Time = now.ToShortTimeString(), Timestamp = now.ToFileTimeUtc(), Guid = Guid.NewGuid() //gera novo GUID }; var rz = new RazorTemplate(); string htmlNotif = rz.ParseRazorTemplate <ModeratorNotificationModel> ("~/Website/Views/NotificationPartials/Accept.cshtml", moderatorNotification); var wrapper = new ModeratorNotificationWrapper() { ChannelId = moderatorNotification.ChannelId, Html = htmlNotif }; NimbusHubContext.Clients.Group(NimbusHub.GetMessageGroupName(invited.Id)).newModeratorNotification(wrapper); StoreNotification(moderatorNotification, invited.Id); }
public void StoreNotification(ModeratorNotificationModel mod, int userid) { using (var db = DatabaseFactory.OpenDbConnection()) { var dbNotif = new Model.ORM.Notification <ModeratorNotificationModel>() { Id = mod.Guid, UserId = userid, IsRead = false, NotificationObject = mod, Timestamp = mod.Timestamp, Type = Model.NotificationTypeEnum.moderatorinvite }; db.Insert <Model.ORM.Notification <ModeratorNotificationModel> >(dbNotif); } }