|
@@ -90,6 +90,11 @@ namespace UnivateProperties_API.Repository.Timeshare
|
90
|
90
|
public void Insert(TimeshareWeek item)
|
91
|
91
|
{
|
92
|
92
|
item = GetDetailedWeek(item);
|
|
93
|
+ item.Id = _dbContext.Weeks.Max(x => x.Id) + 1;
|
|
94
|
+ if (item.Owner != null && item.Owner.Id == 0)
|
|
95
|
+ {
|
|
96
|
+ item.Owner.Id = _dbContext.Individuals.Max(x => x.Id) + 1;
|
|
97
|
+ }
|
93
|
98
|
// Set starting Status of A1
|
94
|
99
|
StatusRepository repo = new StatusRepository(_dbContext);
|
95
|
100
|
item.Status = repo.GetDetailed(s => s.Code == "A1");
|
|
@@ -104,7 +109,7 @@ namespace UnivateProperties_API.Repository.Timeshare
|
104
|
109
|
ModifiedBy = "KobusB"
|
105
|
110
|
};
|
106
|
111
|
}
|
107
|
|
- _dbContext.Add(item);
|
|
112
|
+ _dbContext.Add(item);
|
108
|
113
|
Save();
|
109
|
114
|
}
|
110
|
115
|
|