RoutePrefix和Route 路由前缀

 

 

使用应用到某个控制器中所有操作的路由前缀来批注该控制器。

 

web api

/// <summary>
    ////// </summary>
    [RoutePrefix("web/Business")]
    public class BusinessController : ApiController
    {
        /// <summary>
        ////// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [Route("GetData"), System.Web.Http.HttpGet]
        public BusinessResponse GetData([FromUri]BusinessRequest request)
        {
            BusinessResponse response = new BusinessResponse();
            response = Service.Execute(request);return response;
        }
    }

前端调用

var VueDataService = {
    apiUrls: {
        getUrl: BPMUtil.apiBasePath + "/Web/Business/GetData"
    },
    getFormData: function (id) {
        return axios.get(this.apiUrls.getUrl + "?request.recordId=" + id);
    }
};

 

posted @ 2017-06-14 11:13  直钩钓鱼  阅读(11096)  评论(1编辑  收藏  举报