Esempio n. 1
0
 public ResultInfo Edit(NewsItem newsItem)
 {
     _newsItemRepository.Update(newsItem);
     return new ResultInfo("修改成功");
 }
Esempio n. 2
0
        public ActionResult NewsEdit(NewsItem newsItem)
        {
            ResultInfo resultInfo = new ResultInfo(1, "验证不通过");

            if (ModelState.IsValid)
            {
                NewsItem oldNewsItem = _newsService.GetById(newsItem.NewsId);

                if (oldNewsItem == null)
                {
                    return Json(new ResultInfo(1, "该信息已被删除或不存在,请刷新列表!"));
                }

                oldNewsItem = newsItem;

                resultInfo = _newsService.Edit(newsItem);
            }

            return Json(resultInfo);
        }
Esempio n. 3
0
 public ResultInfo Add(NewsItem newsItem)
 {
     _newsItemRepository.Add(newsItem);
     return new ResultInfo("添加成功");
 }
Esempio n. 4
0
        public ActionResult NewsAdd(NewsItem newsItem)
        {
            ResultInfo resultInfo = new ResultInfo(1, "验证不通过");

            if (ModelState.IsValid)
            {
                resultInfo = _newsService.Add(newsItem);
            }

            return Json(resultInfo);
        }