Пример #1
0
        public IActionResult GetUserVerificationRequest()
        {
            var user = UserService.Get(long.Parse(User.Identity.Name));

            if (user == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Пользователь не найден"
                }));
            }

            var verificationRequest = UserVerificationRequestService.GetVerificationRequest(user);

            if (verificationRequest == null)
            {
                return(Ok(new DataResponse <UserVerificationRequestViewModel>
                {
                    Data = null
                }));
            }

            return(Ok(new DataResponse <UserVerificationRequestViewModel>
            {
                Data = new UserVerificationRequestViewModel(verificationRequest)
            }));
        }
Пример #2
0
        public async Task <IActionResult> VerificationRequest([FromForm] VerificationRequest request)
        {
            var user = UserService.Get(long.Parse(User.Identity.Name));

            if (user == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Пользователь не найден"
                }));
            }

            var verificationRequest = UserVerificationRequestService.GetVerificationRequest(user);

            if (verificationRequest != null)
            {
                return(BadRequest(new ResponseModel
                {
                    Success = false,
                    Message = "Вы уже отправили запрос на верификацию"
                }));
            }

            var document = await FileService.SaveFileForm(request.Document);

            var selfie = await FileService.SaveFileForm(request.Selfie);

            UserVerificationRequestService.CreateVerificationRequest(user, document, selfie);

            return(Ok(new ResponseModel()));
        }