Exemplo n.º 1
0
 public IHttpActionResult AddComment(int id, CommentBindingModel comment)
 {
     if (ModelState.IsValid)
     {
         return(Ok(_eventService.AddComment(id, User.Identity.Name, comment)));
     }
     return(BadRequest());
 }
Exemplo n.º 2
0
        public ActionResult CommentPost(EventDetailViewModel eventDetailViewModel)
        {
            CommentViewModel commentViewModel = eventDetailViewModel.Comment;
            UserViewModel    User             = (UserViewModel)Session["User"];

            commentViewModel.Date         = DateTime.Now;
            commentViewModel.UserID       = (int)User.UserID;
            commentViewModel.UserFullName = User.FullName;
            commentViewModel.EventID      = (int)Session["EventID"];
            CommentDTO CommentDTO = EventMapping.CommentViewModel2CommentDTO(commentViewModel);

            EventService.AddComment(CommentDTO);
            Session["EventID"] = null;
            return(RedirectToAction("Details", new { id = commentViewModel.EventID }));
        }