public ActionResult CreateArticle(ArticleViewModel model) { var name = HttpContext.User.Identity.Name; var id = userService.GetOneByPredicate(n => n.Login == name).Id; model.AuthorId = Convert.ToInt32(id); model.CountLikes = 0; model.PublicationDate = DateTime.Now; articleService.Create(model.GetBllEntity()); return(RedirectToAction("Index", "Home")); }
public ActionResult UpdateArticle(ArticleViewModel model) { model.PublicationDate = DateTime.Now; articleService.Edit(model.GetBllEntity()); return(RedirectToAction("Index", "Home")); }