示例#1
0
        public void AddEmail(EmailModel emailModel)
        {
            if (string.IsNullOrEmpty(emailModel.Text))
            {
                throw new EmailException(null, emailModel.UserId, "Required text field!!");
            }
            var email = EmailMapper.EmailModelToEmail(emailModel);

            _emailRepo.Insert(email);
        }
示例#2
0
        public void UpdateEmail(EmailModel emailModel)
        {
            var emailCheck = _emailRepo.GetById(emailModel.Id);

            if (emailCheck == null)
            {
                throw new Exception("No such email to upload");
            }

            if (string.IsNullOrEmpty(emailModel.Text))
            {
                throw new Exception("No Text field found. Please put a text field.");
            }
            var email = EmailMapper.EmailModelToEmail(emailModel);

            _emailRepo.Update(email);
        }