ASP.NET (Web Api) editor.PostCreate with LeftJoin
ASP.NET (Web Api) editor.PostCreate with LeftJoin

I need to run a function that sends a mail after a record has been inserted,
unfortunately, the function is not being executed, kindly let me know what's wrong with my code?
using (var db = new Database("sqlserver", settings))
{
var editor = new Editor(db, "activities")
.Model<ActivitiesModel1>("activities")
.Model<CompaniesModel>("companies")
.Field(new Field("activities.activitytype")
.Validator(Validation.NotEmpty())
)
.LeftJoin("companies", "companies.id", "=", "activities.bpid")
.Where("activities.repid", 1);
editor.PostCreate += (sender, e) =>
{
try
{...some code to send a mail}
catch (Exception)
{
Console.WriteLine("something happened");
}
};
var response = editor.Process(request).Data();
return Json(response);
Thanks alot!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
There isn't anything obviously wrong there. This is the line of code that will trigger that event handler. It doesn't look like there is much that could stop it executing.
What is the response from the server when you perform the insert action please?
Thanks,
Allan
Thanks Allan! issue resolved I had to restart visual studio. at that point, I had already sorted the issue using ajax..
editor.on('preEdit', function (e, json, data, id) {
$.ajax...
});