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

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

BigDataWarehouseBigDataWarehouse Posts: 23Questions: 10Answers: 0

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

Answers

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin
    Answer ✓

    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

  • BigDataWarehouseBigDataWarehouse Posts: 23Questions: 10Answers: 0
    edited December 2020

    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...
    });

This discussion has been closed.