Exemplo n.º 1
0
        public ActionResult AddComment(WorkViewModel workviewmodel)
        {
            var work = workRepository.GetByID(workviewmodel.WorkComment.WorkId);

            if (ModelState.IsValid)
            {
                workviewmodel.WorkComment.UserId = WebSecurity.CurrentUserId;
                workRepository.InsertWorkComment(workviewmodel.WorkComment);
                unitOfWork.Save();
                return(RedirectToAction("Details", new { id = workviewmodel.WorkComment.WorkId }));
            }
            workviewmodel.Work = work;
            return(View("~/Views/Works/Details.cshtml", workviewmodel));
        }