public JsonResult CreateOrUpdate(ArticleDto model)
 {
     if (model.Id == 0)
     {
         this.Create(model);
     }
     else
     {
         this.Update(model);
     }
     return Json(1, JsonRequestBehavior.AllowGet);
 }
 public ActionResult Edit(int? id)
 {
     ArticleDto model = null;
     if (!id.HasValue)  //新建
     {
         model = new ArticleDto();
     }
     else  //编辑
     {
         model = _articleService.GetById(id.Value);
     }
     return View(model);
 }
        public JsonResult Update(ArticleDto model)
        {
            _articleService.Update(model);
            return Json(1, JsonRequestBehavior.AllowGet);

        }
Exemple #4
0
        public void Update(ArticleDto model)
        {
            var entity = _articleRepository.GetById(model.Id);

            _articleRepository.Update(model.MapTo(entity));
        }
Exemple #5
0
 public void Create(ArticleDto model)
 {
     _articleRepository.Insert(model.MapTo <Article>());
 }
 public void Update(ArticleDto model)
 {
     var entity = _articleRepository.GetById(model.Id);
     _articleRepository.Update(model.MapTo(entity));
 }
 public void Create(ArticleDto model)
 {
     _articleRepository.Insert(model.MapTo<Article>());
 }