public HttpResponseMessage getImg() { var img = _ctx.Index.Where(x => x.Id == 4); var res = ResultToJson.toJson(img); res.Headers.Add("Access-Control-Allow-Origin", "*"); return(res); }
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)); }