public void SendAndSaveQuestionAboutAdvert(AdvertContactEmailViewModel model) { var msg = _parseEmailService.QuestionAboutAdvert(model); var email = _smtpManager.SendEmail(msg); var message = Mapper.Map <Message>(model); message.Body = email.Body; _saveEmailService.SaveEmail(message); }
public ActionResult Show(AdvertContactEmailViewModel advertContactEmail, int id) { var model = _readAdvertService.GetAdvertById(id); if (ModelState.IsValid) { advertContactEmail.AdvertId = id; _emailRepository.SendAndSaveQuestionAboutAdvert(advertContactEmail); return(View(model)); } return(View(model)); }
public EmailMessage QuestionAboutAdvert(AdvertContactEmailViewModel model) { var template = _templateRepository.QuestionAboutAdvert(); var body = Engine.Razor.RunCompile(template, "QuestionAboutAdvert", typeof(AdvertContactEmailViewModel), model); var message = new EmailMessage() { Body = body, From = model.Email, Subject = "Pytanie dotyczące oferty" }; return(message); }