Getting action type in server

Getting action type in server

dynasoftdynasoft Posts: 422Questions: 67Answers: 3

Hi

I have the code below to try and grab the action from editor. But when 1st loading the datatable, the code inside editor.Validator does not get hit and so actionType always returns null when I believe DtRequest.RequestTypes.DataTablesGet should be returned. Editor seems to do a 2nd pass and returns action = DataTablesGet. The same goes for EditorCreate and EditorUpload. Is there a better way to grab the current action being done by editor (create, remove,...) rather than via a validator?

    public static DtResponse CRUDCDRDataAndFiles(int intCdrFrmtSrc, int intCdrFrmtTpe, string strCdrFrmtNme, CDRDataUISettings lblo)
    {
        Editor editor = null;         
        DtRequest.RequestTypes? actionType = null;

        HttpRequest formData = System.Web.HttpContext.Current.Request;                

        using (Database db = new Database(SetGetDbType2, SetGetDbConnection))
        {
            editor = new Editor(db, "AutoCDRFiles").Model<CDRDataDBModel>();
            editor.Validator((editor1, action, data) =>
            {
                actionType = action;
                return null;
            });
            editor.Field(new Field("id")
                .Set(false)
            );

            if (actionType != DtRequest.RequestTypes.EditorUpload)
            {
            ...
            }

            editor.TryCatch(false);
            editor.Debug(true);
            editor.Process(formData);
            editor.Data();
        }
    }

Answers

This discussion has been closed.