- [RoutePrefix("api/datasets")]
- public class DataSetsController : Controller
- {
- [Route("{id}/content")]
- [HttpGet]
- public ActionResult GetDataSetContent(string id)
- {
- var dataSetsService = HttpContext.GetServiceFromContext<IDataSetsService>();
- if (string.IsNullOrWhiteSpace(id)) return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- var dataSet = (string) dataSetsService.GetDataSet(id);
- return new ContentResult { Content = dataSet, ContentType = "application/json" };
- }
- [Route("list")]
- [HttpGet]
- public ActionResult GetDataSetsList()
- {
- var dataSetsService = HttpContext.GetServiceFromContext<IDataSetsService>();
- var dataSetsList = dataSetsService.GetDataSetsList();
- return Json(dataSetsList, JsonRequestBehavior.AllowGet);
- }
- }
复制代码
你好,我的路由是可以访问的,就是这里的api不能修改重命名吗? |