|
@@ -5,7 +5,9 @@ using UnivateProperties_API.Containers.Users;
|
5
|
5
|
using UnivateProperties_API.Containers.Users.Simple;
|
6
|
6
|
using UnivateProperties_API.Context;
|
7
|
7
|
using UnivateProperties_API.Helpers;
|
|
8
|
+using UnivateProperties_API.Model.Communication;
|
8
|
9
|
using UnivateProperties_API.Model.Users;
|
|
10
|
+using UnivateProperties_API.Repository.Communication;
|
9
|
11
|
|
10
|
12
|
namespace UnivateProperties_API.Repository.Users
|
11
|
13
|
{
|
|
@@ -99,6 +101,8 @@ namespace UnivateProperties_API.Repository.Users
|
99
|
101
|
|
100
|
102
|
Create(createUser, individual.Password, false);
|
101
|
103
|
|
|
104
|
+ Person p = null;
|
|
105
|
+
|
102
|
106
|
if (personType == PersonType.Agent)
|
103
|
107
|
{
|
104
|
108
|
Agent agent = new Agent()
|
|
@@ -112,6 +116,8 @@ namespace UnivateProperties_API.Repository.Users
|
112
|
116
|
Agency = agency
|
113
|
117
|
};
|
114
|
118
|
agent.Id = NewAgentId();
|
|
119
|
+ agent.User.Role = Role.Agency;
|
|
120
|
+ p = agent;
|
115
|
121
|
_dbContext.Agents.Add(agent);
|
116
|
122
|
}
|
117
|
123
|
else if (personType == PersonType.Individual)
|
|
@@ -126,8 +132,32 @@ namespace UnivateProperties_API.Repository.Users
|
126
|
132
|
Telephone = individual.Telephone
|
127
|
133
|
};
|
128
|
134
|
i.Id = NewIndividualId();
|
|
135
|
+ i.User.Role = Role.PrivateUser;
|
|
136
|
+ p = i;
|
129
|
137
|
_dbContext.Individuals.Add(i);
|
|
138
|
+
|
|
139
|
+ }
|
|
140
|
+ Template template = _dbContext.Templates.FirstOrDefault(x => x.Name == "IndivRegEmail");
|
|
141
|
+ if (template != null && personType == PersonType.Individual)
|
|
142
|
+ {
|
|
143
|
+ TemplateRepository templateRepository = new TemplateRepository(_dbContext);
|
|
144
|
+ templateRepository.SendEmailTemplate(template, p, new List<Model.BaseEntity>() { p });
|
|
145
|
+ }
|
|
146
|
+
|
|
147
|
+ Template templ = _dbContext.Templates.FirstOrDefault(x => x.Name == "AgencyRegEmail");
|
|
148
|
+ if (templ != null)
|
|
149
|
+ {
|
|
150
|
+ TemplateRepository templateRepository = new TemplateRepository(_dbContext);
|
|
151
|
+ templateRepository.SendEmailTemplate(templ, p, new List<Model.BaseEntity>() { p });
|
130
|
152
|
}
|
|
153
|
+
|
|
154
|
+ Template temp = _dbContext.Templates.FirstOrDefault(x => x.Name == "VerificationEmail");
|
|
155
|
+ if (temp != null)
|
|
156
|
+ {
|
|
157
|
+ TemplateRepository templateRepository = new TemplateRepository(_dbContext);
|
|
158
|
+ templateRepository.SendEmailTemplate(temp, p, new List<Model.BaseEntity>() { p });
|
|
159
|
+ }
|
|
160
|
+
|
131
|
161
|
if (save)
|
132
|
162
|
{
|
133
|
163
|
Save();
|