public ValidationResult ValidateBlockListModel(BlockListDto blockListModel)
        {
            var validator       = new BlockListValidator();
            var validatorResult = validator.Validate(blockListModel);

            return(validatorResult);
        }
Example #2
0
        public ActionResult Post([FromBody] BlockListDto block)
        {
            var validationResult = _validator.ValidateBlockListModel(block);

            if (!validationResult.IsValid)
            {
                return(BadRequest(new { message = validationResult.Errors }));
            }

            var blockModel = _mapper.Map <BlockList>(block);

            _blockListService.BlockUser(blockModel);
            return(Ok());
        }