public HttpResponseMessage swiper() { var _ctx = new foreignShopEntities(); var newIndex = new Index { SwiperProductId = 1, SwiperProductName = "我超级爱春梅", SwiperLinker = "https://huyaimg.msstatic.com/cdnimage/gamebanner/phpCRjeHH1528708655.jpg" }; _ctx.Index.Add(newIndex); _ctx.SaveChanges(); return(ResultToJson.toJson(newIndex)); }
protected override void Initialize(HttpControllerContext controllerContext) { _ctx = new foreignShopEntities(); base.Initialize(controllerContext); }