コード例 #1
0
        public MailSentDTO SentEmail(MailSentDTO mail)
        {
            Mail mailC = new Mail();

            mailC.From         = mail.From;
            mailC.To           = mail.To;
            mailC.MessageEmail = mail.MessageEmail;
            mailC.ObjectEmail  = mail.ObjectEmail;
            mailC.Personne     = _context.Personnes.Find(mail.CodePersonne);
            mailC.DateEmail    = DateTime.Now;
            mailC.Deleted      = false;
            mailC.Sent         = true;
            mailC.Readen       = false;
            _context.Mails.Add(mailC);

            Mail mailCopie = new Mail();

            mailCopie.From         = mail.From;
            mailCopie.To           = mail.To;
            mailCopie.MessageEmail = mail.MessageEmail;
            mailCopie.ObjectEmail  = mail.ObjectEmail;
            mailCopie.Personne     = _context.Personnes.Where(e => e.Email == mail.To).FirstOrDefault();
            mailCopie.DateEmail    = DateTime.Now;
            mailCopie.Deleted      = false;
            mailCopie.Sent         = true;
            mailCopie.Readen       = false;
            _context.Mails.Add(mailCopie);
            Save();
            return(mail);
        }
コード例 #2
0
        public List <MailSentDTO> GetEmailDeletedList(int idPersonne)
        {
            List <MailSentDTO> mailsDTO = new List <MailSentDTO>();

            foreach (Mail mail in _context
                     .Mails
                     .Include(e => e.Personne)
                     .Where(e => e.Deleted == true && e.Personne.CodePersonne == idPersonne)
                     .ToList())
            {
                MailSentDTO mailSentDTO = new MailSentDTO();
                mailSentDTO.DateEmail    = mail.DateEmail;
                mailSentDTO.Deleted      = mail.Deleted;
                mailSentDTO.From         = mail.From;
                mailSentDTO.MessageEmail = mail.MessageEmail;
                mailSentDTO.ObjectEmail  = mail.ObjectEmail;
                mailSentDTO.Sent         = mail.Sent;
                mailSentDTO.To           = mail.To;
                mailSentDTO.IdEmail      = mail.IdEmail;
                mailSentDTO.CodePersonne = _context.Employes.Where(e => e.Email == mail.From).FirstOrDefault().CodePersonne;
                mailSentDTO.NomPersonne  = _context.Employes.Where(e => e.Email == mail.From).FirstOrDefault().NomPersonne;
                mailSentDTO.Username     = _context.Employes.Where(e => e.Email == mail.From).FirstOrDefault().Username;
                mailsDTO.Add(mailSentDTO);
            }

            return(mailsDTO);
        }
コード例 #3
0
        public MailSentDTO DraftEmail(MailSentDTO mail)
        {
            Mail mailC = new Mail();

            mailC.From         = mail.From;
            mailC.To           = mail.To;
            mailC.MessageEmail = mail.MessageEmail;
            mailC.ObjectEmail  = mail.ObjectEmail;
            mailC.Personne     = _context.Personnes.Find(mail.CodePersonne);
            mailC.DateEmail    = DateTime.Now;
            mailC.Deleted      = false;
            mailC.Sent         = false;
            _context.Mails.Add(mailC);
            Save();
            return(mail);
        }
コード例 #4
0
 public Mail SendingDraftEmail([FromBody] MailSentDTO mail)
 {
     return(_emailRepository.SendingDraftEmail(mail));
 }