This commit is contained in:
2018-09-19 15:29:06 +00:00
parent 28275c4206
commit 893971e784
3 changed files with 37 additions and 16 deletions

View File

@@ -210,7 +210,7 @@ namespace AyaNova.Api.Controllers
{
//Log
EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.Widget, AyaEvent.Modified), ct);
Search.ProcessUpdatedObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes);
Search.ProcessUpdatedObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes, o.Name);
await ct.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
@@ -287,8 +287,11 @@ namespace AyaNova.Api.Controllers
{
//Log
EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.Widget, AyaEvent.Modified), ct);
Search.ProcessUpdatedObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes);
await ct.SaveChangesAsync();
//this will save the context as part of it's operations
Search.ProcessUpdatedObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes, o.Name);
}
catch (DbUpdateConcurrencyException)
{
@@ -352,9 +355,12 @@ namespace AyaNova.Api.Controllers
//Log now that we have the Id
EventLogProcessor.AddEntry(new Event(biz.userId, o.Id, AyaType.Widget, AyaEvent.Created), ct);
Search.ProcessNewObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes);
await ct.SaveChangesAsync();
//this will save the context as part of it's operations
Search.ProcessNewObjectKeywords(ct, LocaleIdFromContext.Id(HttpContext.Items), o.Id, AyaType.Widget, o.Name, o.Notes, o.Name);
//return success and link
return CreatedAtAction("GetWidget", new { id = o.Id }, new ApiCreatedResponse(o));
}
@@ -406,9 +412,12 @@ namespace AyaNova.Api.Controllers
//Log
EventLogProcessor.DeleteObject(biz.userId, AyaType.Widget, dbObj.Id, dbObj.Name, ct);
Search.ProcessDeletedObjectKeywords(ct, dbObj.Id, AyaType.Widget);
await ct.SaveChangesAsync();
//This will directly execute and is not part of context for saving purposes
Search.ProcessDeletedObjectKeywords(ct, dbObj.Id, AyaType.Widget);
//Delete children / attached objects
biz.DeleteChildren(dbObj);