/// <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.,:;&$%()-+ ]+$"); }); }
/// <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 +++++++++++++++"); }
public DashboardsController(IDashboardsService service) { _dashboardsService = service; }
public DashboardsController(IDashboardsService dashboardsService) { this.dashboardsService = dashboardsService; }
public DashboardsController(IDashboardsService dashboardsService, IMapper mapper) { this.dashboardsService = dashboardsService; this.mapper = mapper; }