Exemplo n.º 1
0
        public override async Task <IViewProviderResult> BuildUpdateAsync(Topic entity, IViewProviderContext context)
        {
            if (!context.Updater.ModelState.IsValid)
            {
                return(await BuildIndexAsync(entity, context));
            }

            // Execute UpdateModel within registered spam operators
            await _spamOperatorManager.UpdateModelAsync(SpamOperations.Topic, entity);

            // Return view
            return(await BuildIndexAsync(entity, context));
        }
Exemplo n.º 2
0
        public override async Task <IViewProviderResult> BuildUpdateAsync(LoginPage userLogin, IViewProviderContext context)
        {
            if (!context.Updater.ModelState.IsValid)
            {
                return(await BuildIndexAsync(userLogin, context));
            }

            // Build user to validate
            var user = await BuildUserAsync(userLogin);

            // Could not build user details from supplied username
            if (user == null)
            {
                return(await BuildIndexAsync(userLogin, context));
            }

            // Execute UpdateModel within registered spam operators
            await _spamOperatorManager.UpdateModelAsync(SpamOperations.Login, user);

            return(await BuildIndexAsync(userLogin, context));
        }
Exemplo n.º 3
0
        public override async Task <IViewProviderResult> BuildUpdateAsync(UserRegistration registration, IViewProviderContext context)
        {
            // We need a valid view model
            if (!context.Updater.ModelState.IsValid)
            {
                return(await BuildIndexAsync(registration, context));
            }

            // If we reach the BuildUpdateAsync method the user has
            // been validated & created so retrieve full user from database
            var user = await _platoUserStore.GetByUserNameAsync(registration.UserName);

            //  User not found
            if (user == null)
            {
                return(await BuildIndexAsync(registration, context));
            }

            // Execute UpdateModel within registered spam operators
            await _spamOperatorManager.UpdateModelAsync(SpamOperations.Login, user);

            // Return view
            return(await BuildIndexAsync(registration, context));
        }