<commit_before>﻿using Microsoft.AspNet.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DevExtreme.AspNet.TagHelpers.Data {

    public partial class LoadActionDatasourceTagHelper : StoreDatasourceTagHelper {
        IUrlHelper _urlHelper;

        public LoadActionDatasourceTagHelper(IUrlHelper urlHelper) {
            _urlHelper = urlHelper;
        }

        public string Controller { get; set; }
        public string LoadAction { get; set; }
        public string UpdateAction { get; set; }
        public string UpdateMethod { get; set; }
        public string InsertAction { get; set; }
        public string InsertMethod { get; set; }
        public string DeleteAction { get; set; }
        public string DeleteMethod { get; set; }
        public string OnBeforeSend { get; set; }

        protected override string FormatStoreFactory(string args) {
            return "DevExpress.data.AspNet.createStore(" + args + ")";
        }

        protected override void PopulateStoreConfig(IDictionary<string, object> config) {
            TryAddAction(config, "load", LoadAction, null);
            TryAddAction(config, "insert", InsertAction, InsertMethod);
            TryAddAction(config, "update", UpdateAction, UpdateMethod);
            TryAddAction(config, "delete", DeleteAction, DeleteMethod);

            if(!String.IsNullOrEmpty(OnBeforeSend))
                config["onBeforeSend"] = new JRaw(OnBeforeSend);
        }


        void TryAddAction(IDictionary<string, object> config, string name, string action, string method) {
            if(!String.IsNullOrEmpty(action))
                config[name + "Url"] = GetActionUrl(action);

            if(!String.IsNullOrEmpty(method))
                config[name + "Method"] = method;
        }

        string GetActionUrl(string action) {
            var result = _urlHelper.Action(action, Controller);
            if(String.IsNullOrEmpty(result))
                throw new Exception($"Unable to resolve Datasource action: '{Controller}.{action}'");

            return result;<commit_msg>Try prefix removed from methods names due to wrong usage<commit_after>﻿using Microsoft.AspNet.Mvc;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DevExtreme.AspNet.TagHelpers.Data {

    public partial class LoadActionDatasourceTagHelper : StoreDatasourceTagHelper {
        IUrlHelper _urlHelper;

        public LoadActionDatasourceTagHelper(IUrlHelper urlHelper) {
            _urlHelper = urlHelper;
        }

        public string Controller { get; set; }
        public string LoadAction { get; set; }
        public string UpdateAction { get; set; }
        public string UpdateMethod { get; set; }
        public string InsertAction { get; set; }
        public string InsertMethod { get; set; }
        public string DeleteAction { get; set; }
        public string DeleteMethod { get; set; }
        public string OnBeforeSend { get; set; }

        protected override string FormatStoreFactory(string args) {
            return "DevExpress.data.AspNet.createStore(" + args + ")";
        }

        protected override void PopulateStoreConfig(IDictionary<string, object> config) {
            AddAction(config, "load", LoadAction, null);
            AddAction(config, "insert", InsertAction, InsertMethod);
            AddAction(config, "update", UpdateAction, UpdateMethod);
            AddAction(config, "delete", DeleteAction, DeleteMethod);

            if(!String.IsNullOrEmpty(OnBeforeSend))
                config["onBeforeSend"] = new JRaw(OnBeforeSend);
        }


        void AddAction(IDictionary<string, object> config, string name, string action, string method) {
            if(!String.IsNullOrEmpty(action))
                config[name + "Url"] = GetActionUrl(action);

            if(!String.IsNullOrEmpty(method))
                config[name + "Method"] = method;
        }

        string GetActionUrl(string action) {
            var result = _urlHelper.Action(action, Controller);
            if(String.IsNullOrEmpty(result))
                throw new Exception($"Unable to resolve Datasource action: '{Controller}.{action}'");

            return result;
{'fraction_non_alphanumeric': 0.09426987060998152, 'fraction_numerical': 0.0, 'mean_word_length': 2.7190721649484537, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '15929', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1095, 'n_words': 290}