How to get newly inserted id on OnResultExecuted

6 months ago
Hi all,

I need help.

How to get inserted Id on "OnResultExecuted" event

My code is this.

public override void OnResultExecuted(ResultExecutedContext context)
{
  if (!(context.ActionDescriptor is ControllerActionDescriptor actionDescriptor)) return;

  if (actionDescriptor.ControllerTypeInfo == typeof([controllerName]) &&
    (actionDescriptor.ActionName == "Create" || actionDescriptor.ActionName == "Edit") &&
    context.HttpContext.Request.Method == "POST")
  {
    var data = context.HttpContext.Request.Form["Id"];
    var data1 = context.HttpContext.Request.Form["Text1"];
    var data2 = context.HttpContext.Request.Form["Text2"];
    return;
  }
  else
  {
    return;
  }
}

At the time of edit I get the id but at the time of create I can't get the Id field.
Is there any way to get the Id.
6 months ago
You would have to listen for an event on the particular entity you working with.

ID's and generally created server side and not parsed through ajax or form requests.
5 months ago
Hi All,

I want to save some extra fields on GenericAttribute at the time of Create or update.
Is there there any way to do this?