public async Task <IActionResult> PutMailHistory(int id, MailHistory mailHistory)
        {
            if (id != mailHistory.Id)
            {
                return(BadRequest());
            }

            _context.Entry(mailHistory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MailHistoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <MailHistory> > PostMailHistory(MailHistory mailHistory)
        {
            _context.MailHistory.Add(mailHistory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMailHistory", new { id = mailHistory.Id }, mailHistory));
        }
Пример #3
0
        public bool SaveMailHistory(string frmAddress, string toAddress, string ccAddress, string body, int quoteId = 0, string type = null, int personID = 0, string quoteTitle = null)
        {
            MailHistory mailHistory = new MailHistory();

            mailHistory.FromEmail  = frmAddress;
            mailHistory.To         = toAddress;
            mailHistory.BCC        = ccAddress;
            mailHistory.SendDate   = DateTime.UtcNow;
            mailHistory.MailBody   = body;
            mailHistory.type       = type;
            mailHistory.quoteId    = quoteId;
            mailHistory.PersonId   = personID;
            mailHistory.QuoteTitle = quoteTitle;
            _Context.EmailHistory.Add(mailHistory);
            _Context.EmailHistory.SaveChanges();
            return(true);
        }