public void MarkAsRead(IList <int> ids, bool read) { Trace.Assert(Context.PersonId.HasValue); PrivateMessageSecurity.EnsureMessgingPermission(Context); if (ids != null) { using (var uow = Update()) { var da = new PrivateMessageRecipientDataAccess(uow); var messagesRecipients = da.GetNotDelatedMessageRecpients(ids, Context.PersonId.Value); if (messagesRecipients.Count == 0) { throw new ChalkableSecurityException(ChlkResources.ERR_PRIVATE_MESSAGE_MARK_INVALID_RIGHTS); } foreach (var messageRecipient in messagesRecipients) { messageRecipient.Read = read; } da.Update(messagesRecipients); uow.Commit(); } } }
private void DeleteIncomeMesssages(IList <int> ids, UnitOfWork uow) { var da = new PrivateMessageRecipientDataAccess(uow); var messagesRecipients = da.GetNotDelatedMessageRecpients(ids, Context.PersonId.Value); if (messagesRecipients.Count == 0) { throw new ChalkableSecurityException(ChlkResources.ERR_PRIVATE_MESSAGE_MARK_INVALID_RIGHTS); } foreach (var messageRecipient in messagesRecipients) { messageRecipient.DeletedByRecipient = true; } da.Update(messagesRecipients); }