コード例 #1
0
        /// <summary>
        /// Validates the dashboard when created.
        /// </summary>
        public DashboardCreateValidator(IDashboardsService service)
        {
            CascadeMode = CascadeMode.StopOnFirstFailure;

            RuleSet("Create", () =>
            {
                RuleFor(x => x.ChartId)
                .NotEmpty()
                .Must(id => id > 0)
                .MustAsync((async(id, token) => (await service.ExistsChartIdAsync(id).ConfigureAwait(false))))
                .WithMessage(Resources.Resource.NotFoundChartById);

                RuleFor(x => x.ReportId)
                .NotEmpty()
                .MaximumLength(128)
                .Matches(@"^[a-zA-Z0-9-]+$")
                .MustAsync((async(id, token) => (await service.ExistsReportIdAsync(id).ConfigureAwait(false))))
                .WithMessage(Resources.Resource.NotFoundReportById);

                RuleFor(x => x.Name)
                .Transform(n => n.SpaceFix())
                .NotEmpty()
                .MinimumLength(3)
                .MaximumLength(128)
                .Matches(@"^[а-яА-ЯёЁa-zA-Z0-9.,:;&$%()-+ ]+$");
            });
        }
コード例 #2
0
 /// <summary>
 /// Creates Dashboards controller.
 /// </summary>
 /// <param name="DashboardsService"></param>
 /// <param name="mapper"></param>
 public DashboardsController(
     IDashboardsService DashboardsService,
     IMapper mapper)
 {
     _Dashboardservice = DashboardsService;
     _mapper           = mapper;
     Debug.WriteLine("+++++++++++++++ DashboardsController +++++++++++++++");
 }
コード例 #3
0
 public DashboardsController(IDashboardsService service)
 {
     _dashboardsService = service;
 }
コード例 #4
0
 public DashboardsController(IDashboardsService dashboardsService)
 {
     this.dashboardsService = dashboardsService;
 }
コード例 #5
0
 public DashboardsController(IDashboardsService dashboardsService, IMapper mapper)
 {
     this.dashboardsService = dashboardsService;
     this.mapper            = mapper;
 }