Пример #1
0
        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));
        }
Пример #2
0
 public void AddOrUpdateComment([FromBody] CommentDto commentDto)
 {
     _commentService.AddOrUpdate(commentDto);
 }