public void addComment(Comment model)
 {
     using (IUnitOfWork unitOfWork = new UnitOfWork())
     {
         unitOfWork.getRepository<Comment, int>().Add(model);
         unitOfWork.Save();
     }
 }
 public void Update(Comment model)
 {
     using (IUnitOfWork unitOfWork = new UnitOfWork())
     {
         unitOfWork.getRepository<Comment, int>().Update(model);
         unitOfWork.Save();
     }
 }
        public void InsertItem()
        {
            using (_commentRepository)
            {
                var item = new Entities.Models.Comment();

                TryUpdateModel(item);

                if (!ModelState.IsValid) return;
                item.PostId = long.Parse(RouteData.Values["postId"].ToString());
                using (_postRepository)
                {
                    if (_postRepository.Get(item.PostId) == null)
                    {
                        Response.Error404();
                        return;
                    }
                }
                item.UserId = long.Parse(User.Identity.GetUserId());
                _commentRepository.Add(item);
                Response.RedirectPermanent(GetRouteUrl("ShowPost", new { topicId = RouteData.Values["topicId"] }) + "#post_" + RouteData.Values["postId"]);
            }
        }