Ejemplo n.º 1
0
 public ActionResult Edit(ArticleViewModel model)
 {
     if (ModelState.IsValid)
     {
         logics.EditArticle(model);
     }
     return RedirectToAction("Index", "Home");
 }
Ejemplo n.º 2
0
 public ActionResult Create(ArticleViewModel model)
 {
     if (ModelState.IsValid)
     {
         logics.Create(model);
     }
     else
     {
         return View();
     }
     return RedirectToAction("Index");
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
 public void Create(ArticleViewModel model)
 {
     Mapper.CreateMap<ArticleViewModel, ArticleDTO>();
     _service.CreateArticle(Mapper.Map<ArticleDTO>(model));
 }