Exemple #1
0
        public async Task <bool> RegisterCommonUser(RegisterCommonUserRequest request)
        {
            var copier = new ClassValueCopier();
            //check for used existance
            var result = await _usersCollection.CheckUserExistance(request.EmailId);

            if (!result)
            {
                throw new Exception("User Exists");
            }

            //if no create user
            Users newUser = copier.ConvertAndCopy <Users, RegisterCommonUserRequest>(request);

            newUser.Role         = "CommonUser";
            newUser.IsCommonUser = true;

            //push to DB
            newUser = await _usersCollection.RegisterUserAsync(newUser);

            //Send the userDetails to all the service
            await PublishUserCredentialAsync(newUser);


            return(true);
        }