public async Task <IActionResult> Create([FromBody] CreatePollQuestion x, [FromRoute] int pollId)
        {
            var resultP = await _pollService.GetById(pollId);

            if (!resultP.Succeeded)
            {
                return(BadRequest(resultP.Errors));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(x));
            }

            var dto = _mapper.Map <DtoPollQuestion>(x);

            dto.Id     = 0;
            dto.PollId = pollId;

            var result = await _pollQuestionService.CreateAsync(dto, UserId);

            if (!result.Succeeded)
            {
                return(UnprocessableEntity());
            }

            return(Ok(result.Result));
        }
        public async Task <IActionResult> Update([FromBody] CreatePollQuestion model, [FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(UnprocessableEntity());
            }

            var dto = await _pollQuestionService.GetById(id);

            if (!dto.Succeeded)
            {
                return(UnprocessableEntity());
            }

            _mapper.Map(model, dto.Result);
            var updated = await _pollQuestionService.UpdateAsync(dto.Result, UserId);

            if (!updated.Succeeded)
            {
                return(UnprocessableEntity());
            }

            return(Ok(updated.Result));
        }