This commit is contained in:
2018-09-25 18:01:30 +00:00
parent 51832b532d
commit 52ba3bb970
4 changed files with 118 additions and 15 deletions

View File

@@ -209,6 +209,7 @@ namespace AyaNova.Api.Controllers
//Log
EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.User, AyaEvent.Modified), ct);
await ct.SaveChangesAsync();
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.User, o.Name, o.EmployeeNumber, o.Notes, o.Name);
}
catch (DbUpdateConcurrencyException)
{
@@ -283,6 +284,7 @@ namespace AyaNova.Api.Controllers
//Log
EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.User, AyaEvent.Modified), ct);
await ct.SaveChangesAsync();
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.User, o.Name, o.EmployeeNumber, o.Notes, o.Name);
}
catch (DbUpdateConcurrencyException)
{
@@ -345,7 +347,12 @@ namespace AyaNova.Api.Controllers
else
{
//EVENT LOG
//Note that event log is processed in the biz object unlike the widget for no apparent reason
//SEARCH INDEXING
Search.ProcessNewObjectKeywords(ct, UserLocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.User, o.Name, o.EmployeeNumber, o.Notes, o.Name);
//return success and link
//NOTE: this is a USER object so we don't want to return some key fields for security reasons
//which is why the object is "cleaned" before return
@@ -398,12 +405,14 @@ namespace AyaNova.Api.Controllers
//Log
EventLogProcessor.DeleteObject(biz.userId, AyaType.User, dbObj.Id, dbObj.Name, ct);
await ct.SaveChangesAsync();
//Delete children / attached objects
biz.DeleteChildren(dbObj);
//This will directly execute and is not part of context for saving purposes
Search.ProcessDeletedObjectKeywords(ct, dbObj.Id, AyaType.User);
return NoContent();
}