public async Task <IActionResult> PostComment(CommentDto model) { if (!model.Email.IsEmail() || model.NickName.IsNullOrWhiteSpace() || model.CommentText.IsNullOrWhiteSpace()) { return(BadRequest()); } model.RemoteIp = HttpContext.Connection.RemoteIpAddress.ToString(); model = await _commentService.AddOrUpdate <CommentDto, int>(model); var result = new ResponseResult <CommentDto>(model); return(Ok(result)); }
public void AddOrUpdateComment([FromBody] CommentDto commentDto) { _commentService.AddOrUpdate(commentDto); }