public JsonResult GetIMEdit(BA_Information result) { using (BuyunSiteEntities db = new BuyunSiteEntities()) { var m = from t in db.BA_Information where t.Name == result.Name && t.Id != result.Id select t; if (m.Count() > 0) { return(Json(new { data = "fail", content = "资讯名称重复!" })); } var BA_Case = from t in db.BA_Information where t.Id == result.Id select t; var resultInfo = BA_Case.FirstOrDefault(); resultInfo.Title = result.Title; resultInfo.Name = result.Name; resultInfo.SubName = result.SubName; resultInfo.Status = result.Status; resultInfo.Image = result.Image; resultInfo.Content = result.Content; resultInfo.AddUser = BasePage.GetCookie("UserNameCookie"); resultInfo.AddTime = DateTime.Now; db.SaveChanges(); return(Json(new { data = "success", content = "修改案例名称成功!" })); } }
public JsonResult GetIMAdd(BA_Information result) { using (BuyunSiteEntities db = new BuyunSiteEntities()) { var m = from t in db.BA_Information where t.Name == result.Name select t; if (m.Count() > 0) { return(Json(new { data = "fail", content = "资讯名称重复!" })); } result.AddUser = BasePage.GetCookie("UserNameCookie"); result.AddTime = DateTime.Now; db.BA_Information.Add(result); db.SaveChanges(); return(Json(new { data = "success", content = "新增资讯成功!" })); } }