コード例 #1
0
        public ActionResult Search(SearchPackage searchPackage)
        {
            var brandFilterSelections = _adminQueries.GetBrandFilterSelections();

            var query = _queries.GetAll().Where(x => brandFilterSelections.Contains(x.BrandId));

            var dataBuilder = new SearchPackageDataBuilder <RiskLevel>(searchPackage, query);

            dataBuilder
            .SetFilterRule(x => x.Brand, (value) => x => x.BrandId == new Guid(value))
            .Map(x => x.Id, x => new object[]
            {
                x.Level,
                x.Name,
                x.Status,
                x.Brand.LicenseeName,
                x.Brand.Name,
                x.CreatedBy,
                Format.FormatDate(x.DateCreated, true),
                //x.UpdatedBy,
                //Format.FormatDate(x.DateUpdated, false),
                x.Description
            });
            var data = dataBuilder.GetPageData(x => x.Name);

            return(new JsonResult {
                Data = data, MaxJsonLength = int.MaxValue, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #2
0
        public void Cannot_execute_RiskQueries_without_permissions()
        {
            // Arrange
            LogWithNewAdmin(Modules.FraudManager, Permissions.Deactivate);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => _riskQueries.GetAll());
        }