示例#1
0
        public Clue Create(MailboxModel value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Clue clue;

            if (!string.IsNullOrEmpty(value.SmtpAddress))
            {
                clue = this.Create(EntityType.Account, value.SmtpAddress.ToLowerInvariant());

                if (value.Mailbox != null)
                {
                    var code = new EntityCode(EntityType.Account, ExchangeSharedMailboxNameConstants.CodeOrigin, value.Mailbox.Guid);
                    clue.Data.EntityData.Codes.Add(code);
                }
            }
            else if (value.Mailbox != null)
            {
                clue = this.Create(EntityType.Account, value.Mailbox.Guid.ToString().ToLowerInvariant());
            }
            else
            {
                throw new ArgumentException("MailboxModel is missing vital data", nameof(value));
            }

            return(clue);
        }
示例#2
0
 internal MailboxContext(MailAccountContext account, MailboxModel mailbox)
 {
     _account              = account;
     _mailbox              = mailbox;
     _showAllMessages      = true;
     _deleteMailboxCommand = new RelayCommand(OnDeleteMailbox);
     _createMailboxCommand = new RelayCommand(OnCreateMailbox);
     _syncMailboxCommand   = new RelayCommand(OnSyncMailbox);
 }
示例#3
0
 private static Task <MailAccountModel> GetAccountAsync(MailboxModel mailbox)
 {
     using (var context = new DatabaseContext()) {
         return(context.MailAccounts.FindAsync(mailbox.AccountId));
     }
 }