public IActionResult Post([FromBody] Comment comment)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState.ToErrorObject()));
     }
     return(Ok(comments.Create(comment)));
 }
Ejemplo n.º 2
0
 public int Create(Comment comment)
 {
     if (comment.Message == null)
     {
         throw new Exception("Message is null");
     }
     return(_comment.Create(comment));
 }
 public IActionResult AddComment([Bind("ProjectInfoId", "TaskId", "Commentdetails", "DateTime", "ApplicationUsersId")] Comment comment)
 {
     if (ModelState.IsValid)
     {
         _commentRepo.Create(comment);
         return(RedirectToAction("ViewAllCommentByTaskId", new{ id = comment.TaskId }));
     }
     return(View(comment));
 }
Ejemplo n.º 4
0
        public OperationResult AddComment(AddComment command)
        {
            OperationResult operationResult = new OperationResult();

            var comment = new Comment(command.Name, command.Email, command.Message, command.ProductId);

            _commentRepo.Create(comment);
            _commentRepo.Save();
            return(operationResult.Succeeded());
        }
Ejemplo n.º 5
0
 public int Create(CreateCommentViewModel model)
 {
     return(_comment.Create(_mapper.Map <Comment>(model)));
 }