Example #1
0
 private bool SendContactEmail(ContactModel contact, Job job)
 {
     string mailTemplate = RenderPartialViewToString("ContactMail", contact);
     var match = Regex.Match(mailTemplate, "<email>(.*)</email>", RegexOptions.Singleline);
     var mailText = match.Groups[1].Value;
     // send email to creator
     return SendEmail(job.Email, "[jobs.preweb.sk] Odpoved od " + contact.Email, mailText);
 }
Example #2
0
 public ActionResult Contact(ContactModel contact)
 {
     if (ModelState.IsValid)
     {
         var job = RepositoryFactory.Action<JobAction>().Load("jobs/" + contact.JobId);
         if (job == null)
         {
             return new HttpNotFoundResult();
         }
         if (SendContactEmail(contact, job))
         {
             return ViewWithAjax("ContactOk");
         }
         return ViewWithAjax("ContactFail");
     }
     return ViewWithAjax(contact);
 }