Esempio n. 1
0
        public ActionResult Create(CommentViewModel comment)
        {
            if (ModelState.IsValid)
            {
                var commentDomain = Mapper.Map <CommentViewModel, Comment>(comment);
                _commentApp.Add(commentDomain);

                return(RedirectToAction("Index"));
            }

            ViewBag.ProductId = new SelectList(_productApp.GetAll(), "ProductId", "Name", comment.ProductId);
            return(View(comment));
        }