Example #1
0
        public async Task <ApiResponse <RegisterResponse> > Register(RegisterRequest registerRequest)
        {
            var existingTenant = await _tenantService.GetTenantByHostname(registerRequest.Appname);

            if (existingTenant != null)
            {
                return(ApiResponse <RegisterResponse> .Error(ErrorProvider.GetErrorMessage("no_tenant")));
            }
            if (registerRequest.Password != registerRequest.PasswordAgain)
            {
                return(ApiResponse <RegisterResponse> .Error());

                //ErrorProvider.GetError("register_password_mismatch")
            }

            var existingUser = _hostRepository.Get <Tenant>(t => t.Responsibles.Any(r => r.Email == registerRequest.Email)
                                                            , includeProperties: "Responsibles").FirstOrDefault();

            if (existingUser != null)
            {
                return(ApiResponse <RegisterResponse> .Error());

                //ErrorProvider.GetError("register_email_in_use")
            }

            Tenant tenant = await CreatePoteantialTenant(registerRequest);

            await ComposeEmailVerificationEmail(tenant);

            return(ApiResponse <RegisterResponse> .Success());
        }
Example #2
0
 public Host Get(int id)
 {
     return(_hostrepository.Get(id));
 }