Ejemplo n.º 1
0
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel, Models.SearchQuery dto)
        {
            viewModel.As <Models.SearchQuery>().Attributes(x => x.CategorySelection).Add(new ReadonlyAttribute());

            if (dto.NotificationMode != DAL.Entities.NotificationMode.OnlyBelowDesired)
            {
                viewModel.As <Models.SearchQuery>().Attributes(m => m.DesiredPrice).Add(new HiddenAttribute());
            }

            return(base.InterceptViewModel(viewModel, dto));
        }
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel, Models.Feedback dto)
        {
            if (!Context.CurrentUserInfo.BusinessRoles.Contains(BusinessRoles.AdminRole))
            {
                viewModel.As <Models.Feedback>().Attributes(x => x.Status).Add(new ReadonlyAttribute());
            }

            if (dto.Status != DAL.Entities.FeedbackStatus.New || !dto.BelongsToCurrentUser)
            {
                viewModel.As <Models.Feedback>().Attributes(x => x.Name).Add(new ReadonlyAttribute());
                viewModel.As <Models.Feedback>().Attributes(x => x.Description).Add(new ReadonlyAttribute());
            }

            return(base.InterceptViewModel(viewModel, dto));
        }
Ejemplo n.º 3
0
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel, Models.SearchResult dto)
        {
            if (!dto.Sold)
            {
                viewModel.As <Models.SearchResult>().Hide(p => p.FinalPrice);
            }

            if (dto.Sold)
            {
                viewModel.As <Models.SearchResult>().Hide(p => p.PurchasePrice);
                viewModel.As <Models.SearchResult>().Hide(p => p.BidPrice);
                viewModel.As <Models.SearchResult>().Hide(p => p.Ends);
            }

            return(base.InterceptViewModel(viewModel, dto));
        }
Ejemplo n.º 4
0
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel, Models.Settings dto)
        {
            if (!dto.EnableEmailNotification)
            {
                viewModel.As <Models.Settings>().Hide(x => x.Email);
                viewModel.As <Models.Settings>().Hide(x => x.AlternativeEmail);
            }

            if (!dto.EnableIftttNotification)
            {
                viewModel.As <Models.Settings>().Hide(x => x.IftttMakerKey);
                viewModel.As <Models.Settings>().Hide(x => x.IftttMakerEventName);
            }

            return(base.InterceptViewModel(viewModel, dto));
        }
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel)
        {
            viewModel.As <Models.Category>().Attributes(m => m.Number).Add(new ReadonlyAttribute());

            return(base.InterceptViewModel(viewModel));
        }
Ejemplo n.º 6
0
        protected override EditViewModel InterceptViewModel(EditViewModel viewModel)
        {
            viewModel.As <Models.Feedback>().Hide(x => x.Status);

            return(base.InterceptViewModel(viewModel));
        }