public ActionResult Edit(ArticleViewModel model) { if (ModelState.IsValid) { logics.EditArticle(model); } return RedirectToAction("Index", "Home"); }
public ActionResult Create(ArticleViewModel model) { if (ModelState.IsValid) { logics.Create(model); } else { return View(); } return RedirectToAction("Index"); }
public void EditArticle(ArticleViewModel model) { Mapper.CreateMap<CommentViewModel, CommentDTO>(); Mapper.CreateMap<ArticleViewModel, ArticleDTO>().ForMember(_ => _.Comments, x => x.MapFrom(_ => _.Comments)); _service.ModifyArticle(Mapper.Map<ArticleDTO>(model)); }
public void Create(ArticleViewModel model) { Mapper.CreateMap<ArticleViewModel, ArticleDTO>(); _service.CreateArticle(Mapper.Map<ArticleDTO>(model)); }