ソースを参照

EnquireNow Mail Edit

master
30117125 4年前
コミット
23fd42eaab
1個のファイルの変更19行の追加3行の削除
  1. 19
    3
      UnivateProperties_API/Repository/Communication/MailRepository.cs

+ 19
- 3
UnivateProperties_API/Repository/Communication/MailRepository.cs ファイルの表示

1
 using MailKit.Net.Smtp;
1
 using MailKit.Net.Smtp;
2
 using MimeKit;
2
 using MimeKit;
3
+using System;
4
+using System.Linq;
5
+using System.Linq.Dynamic.Core;
6
+using UnivateProperties_API.Context;
3
 using UnivateProperties_API.Model.Communication;
7
 using UnivateProperties_API.Model.Communication;
4
 
8
 
5
 namespace UnivateProperties_API.Repository.Communication
9
 namespace UnivateProperties_API.Repository.Communication
12
 
16
 
13
     public class MailRepository : IMailRepository
17
     public class MailRepository : IMailRepository
14
     {
18
     {
19
+        private readonly DataContext _dbContext;
20
+
21
+        public MailRepository(DataContext db)
22
+        {
23
+            _dbContext = db;
24
+        }
25
+
15
         MimeMessage messageObj = new MimeMessage();
26
         MimeMessage messageObj = new MimeMessage();
16
         MailboxAddress from;
27
         MailboxAddress from;
17
         MailboxAddress to;
28
         MailboxAddress to;
63
             string name = mm.Name;
74
             string name = mm.Name;
64
             string email = mm.Email;
75
             string email = mm.Email;
65
             string message = mm.Message;
76
             string message = mm.Message;
66
-
77
+            var props = _dbContext.Properties.ToList();
78
+            var prop = props.Where(x => x.Id == Convert.ToInt32(mm.Property)).FirstOrDefault();
79
+            
67
             from = new MailboxAddress("Admin", mm.FromAddress);
80
             from = new MailboxAddress("Admin", mm.FromAddress);
68
 
81
 
69
             to = new MailboxAddress("User", mm.ToAddress);
82
             to = new MailboxAddress("User", mm.ToAddress);
78
                 "<h4>Email: " + email + "</h4>" +
91
                 "<h4>Email: " + email + "</h4>" +
79
                 "<h4>Phone: " + phone + "</h4>" +
92
                 "<h4>Phone: " + phone + "</h4>" +
80
                 "<div>" +
93
                 "<div>" +
81
-                "<h4>Message: </h4>" +
82
-                "<p>" + message + "</p>" +
94
+                "<h4>Property: </h4>" +
95
+                "<p>" + prop.Id + "</p>" +
96
+                "<p>" + prop.PropertyName + "</p>" +
97
+                "<p>" + prop.PropertyRef + "</p>" +
98
+                "<p>" + prop.Price + "</p>" +
83
                 "</div>" +
99
                 "</div>" +
84
                 "</div>" +
100
                 "</div>" +
85
                 "</div>";
101
                 "</div>";

読み込み中…
キャンセル
保存