public async Task <IActionResult> TenantWithSuchMailExistCheck(CheckEmailRequest checkEmailRequest)
        {
            if (checkEmailRequest.Email == null)
            {
                return(NotFound("Enter valid email"));
            }

            bool tenantExist = await _identityService.CheckIfTenantEmailInUse(checkEmailRequest.Email);

            if (!tenantExist)
            {
                return(BadRequest(new SimpleErrorResponse
                {
                    Success = false,
                    Message = "Tenant does not exist",
                }));
            }
            else
            {
                return(Ok(new SimpleSuccessResponse
                {
                    Success = true,
                    Message = "Tenant exists"
                }));
            }
        }
        public async Task <IActionResult> EmailInUseCheck(CheckEmailRequest checkEmailRequest)
        {
            if (checkEmailRequest.Email == null)
            {
                return(NotFound("Enter valid email"));
            }

            bool emailInUse = await _identityService.CheckIfEmailInUse(checkEmailRequest.Email);

            if (emailInUse)
            {
                return(BadRequest(new SimpleErrorResponse
                {
                    Success = false,
                    Message = "Email not available",
                }));
            }
            else
            {
                return(Ok(new SimpleSuccessResponse
                {
                    Success = true,
                    Message = "Email available"
                }));
            }
        }
Пример #3
0
        public async Task <ActionResult <ApiResponse <CheckEmailResponse> > > CheckEmailExists(CheckEmailRequest request)
        {
            var response = new ApiResponse <CheckEmailResponse>
            {
                Data = new CheckEmailResponse()
            };

            response.Data.Exists = await CheckEmailExists(request.Email);

            return(Ok(response));
        }