|
@@ -143,8 +143,40 @@ namespace UnivateProperties_API.Repository.Properties
|
143
|
143
|
}
|
144
|
144
|
}
|
145
|
145
|
|
|
146
|
+ var images = item.PropertyImages;
|
|
147
|
+ var fields = item.PropertyUserFields;
|
|
148
|
+
|
|
149
|
+ item.PropertyImages = null;
|
|
150
|
+ item.PropertyUserFields = null;
|
|
151
|
+
|
146
|
152
|
dBContext.Properties.Add(item);
|
147
|
153
|
Save();
|
|
154
|
+
|
|
155
|
+ if (images != null)
|
|
156
|
+ {
|
|
157
|
+ foreach (PropertyImage image in images)
|
|
158
|
+ {
|
|
159
|
+ image.PropertyId = item.Id;
|
|
160
|
+ dBContext.PropertyImages.Add(image);
|
|
161
|
+ Save();
|
|
162
|
+ }
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+ if (fields != null)
|
|
166
|
+ {
|
|
167
|
+ var lastID = (from p in dBContext.PropertyUserFields
|
|
168
|
+ orderby p.Id descending
|
|
169
|
+ select p.Id).FirstOrDefault();
|
|
170
|
+
|
|
171
|
+ foreach (PropertyUserField field in fields)
|
|
172
|
+ {
|
|
173
|
+ lastID++;
|
|
174
|
+ field.Id = lastID;
|
|
175
|
+ field.PropertyId = item.Id;
|
|
176
|
+ dBContext.PropertyUserFields.Add(field);
|
|
177
|
+ Save();
|
|
178
|
+ }
|
|
179
|
+ }
|
148
|
180
|
}
|
149
|
181
|
|
150
|
182
|
public void Insert(IEnumerable<Property> items)
|