Ejemplo n.º 1
0
        public string SendAdhokEmail(SendEmailModel mail)
        {
            var result = new DataServiceResult();

            try
            {
                EmailHelper.Send(mail);
                var data = new SendSmsOrEmail();
                data.MessageContent = mail.EmailBody;
                data.MessageDate    = DateTime.Now.Date;
                data.MessgeType     = mail.MessageType;
                data.To             = mail.To;
                data.Subject        = mail.Subject;
                data.From           = mail.From;
                data.MessageReciver = mail.Reciver;
                emailrepo.SaveEmailSMSEntry(data);
                result.Success       = true;
                result.ResultMessage = "Mail send successfully";
            }
            catch (Exception ex)
            {
                result.Success       = false;
                result.ResultMessage = "Mail sending failed";
                result.ExceptionInfo = new ExceptionInfo(ex);
            }
            return(JsonConvert.SerializeObject(result));
        }
Ejemplo n.º 2
0
        public void SaveEmailSMSEntry(SendSmsOrEmail model)
        {
            var repo = new AllRepository <SendSmsOrEmail>();

            if (model.Id == 0)
            {
                model.CreatedOn = DateTime.Now.Date;
                repo.InsertModel(model);
            }
            else
            {
                repo.UpdateModel(model);
            }
            repo.Save();
        }