|  | @@ -1,5 +1,9 @@
 | 
		
	
		
			
			| 1 | 1 |  using MailKit.Net.Smtp;
 | 
		
	
		
			
			| 2 | 2 |  using MimeKit;
 | 
		
	
		
			
			|  | 3 | +using System;
 | 
		
	
		
			
			|  | 4 | +using System.Linq;
 | 
		
	
		
			
			|  | 5 | +using System.Linq.Dynamic.Core;
 | 
		
	
		
			
			|  | 6 | +using UnivateProperties_API.Context;
 | 
		
	
		
			
			| 3 | 7 |  using UnivateProperties_API.Model.Communication;
 | 
		
	
		
			
			| 4 | 8 |  
 | 
		
	
		
			
			| 5 | 9 |  namespace UnivateProperties_API.Repository.Communication
 | 
		
	
	
		
			
			|  | @@ -12,6 +16,13 @@ namespace UnivateProperties_API.Repository.Communication
 | 
		
	
		
			
			| 12 | 16 |  
 | 
		
	
		
			
			| 13 | 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 | 26 |          MimeMessage messageObj = new MimeMessage();
 | 
		
	
		
			
			| 16 | 27 |          MailboxAddress from;
 | 
		
	
		
			
			| 17 | 28 |          MailboxAddress to;
 | 
		
	
	
		
			
			|  | @@ -63,7 +74,9 @@ namespace UnivateProperties_API.Repository.Communication
 | 
		
	
		
			
			| 63 | 74 |              string name = mm.Name;
 | 
		
	
		
			
			| 64 | 75 |              string email = mm.Email;
 | 
		
	
		
			
			| 65 | 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 | 80 |              from = new MailboxAddress("Admin", mm.FromAddress);
 | 
		
	
		
			
			| 68 | 81 |  
 | 
		
	
		
			
			| 69 | 82 |              to = new MailboxAddress("User", mm.ToAddress);
 | 
		
	
	
		
			
			|  | @@ -78,8 +91,11 @@ namespace UnivateProperties_API.Repository.Communication
 | 
		
	
		
			
			| 78 | 91 |                  "<h4>Email: " + email + "</h4>" +
 | 
		
	
		
			
			| 79 | 92 |                  "<h4>Phone: " + phone + "</h4>" +
 | 
		
	
		
			
			| 80 | 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 | 99 |                  "</div>" +
 | 
		
	
		
			
			| 84 | 100 |                  "</div>" +
 | 
		
	
		
			
			| 85 | 101 |                  "</div>";
 |