Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 3
0
 private static Task <MailAccountModel> GetAccountAsync(MailboxModel mailbox)
 {
     using (var context = new DatabaseContext()) {
         return(context.MailAccounts.FindAsync(mailbox.AccountId));
     }
 }