public ActionResult Delete(int newsId) { NewsInfo news = newsContext.newsInfoLists.Find(newsId); newsContext.newsInfoLists.Remove(news); newsContext.SaveChanges(); return(Content("删除成功")); }
public IActionResult Create([FromBody] NewsInfoVM vm) { NewsInfo nw = new NewsInfo(); nw.title = vm.title; nw.description = vm.description; myCtx.NewsInfos.Add(nw); myCtx.SaveChanges(); return(Json(true)); }
public IHttpActionResult Poststudent(NewsInfo student) { ctx.NewsInfos.Add(student); ctx.SaveChanges(); return(Ok(student)); }