public TaskRequestValidatior()
        {
            tableCli = new TableCli(AzureStorageConnection.Instance(), "Projects");
            RuleFor(t => t.Name)
            .NotEmpty()
            .MinimumLength(5)
            .MaximumLength(25);

            RuleFor(t => t.Description)
            .NotEmpty()
            .MinimumLength(10)
            .MaximumLength(200);
            RuleFor(t => t.ProjectId)
            .Must(id => id.Contains("$"))
            .WithMessage("Not a valid ID")
            .DependentRules(() =>
            {
                RuleFor(p => p).Must(p => tableCli.EntityExists(p.ProjectId.Split('$')[0], p.ProjectId.Split('$')[1]))
                .WithMessage(p => $"Project with id '{p.ProjectId}' not found.");
            });
        }
 public TableCliUpdateProjectAsync(IMapper mapper)
 {
     _tableCli = new TableCli(AzureStorageConnection.Instance(), "Projects");;
     _mapper   = mapper;
 }
예제 #3
0
 public LinqGetProject(IMapper mapper)
 {
     _mapper   = mapper;
     _tableCli = new TableCli(AzureStorageConnection.Instance(), "Projects");
 }
 public TableCliCreateTaskAsync(TaskRequestValidatior validator)
 {
     _tableCli   = new TableCli(AzureStorageConnection.Instance(), "Tasks");
     _validatior = validator;
 }
예제 #5
0
 public LinqGetTask(IMapper mapper)
 {
     _mapper   = mapper;
     _tableCli = new TableCli(AzureStorageConnection.Instance(), "Tasks");
 }
 public TableCliDeleteTaskAsync(IMapper mapper)
 {
     _mapper   = mapper;
     _tableCli = new TableCli(AzureStorageConnection.Instance(), "Tasks");
 }
예제 #7
0
 public TableCliQueryProject(IMapper mapper)
 {
     _tableCli = new TableCli(AzureStorageConnection.Instance(), "Projects");
     _mapper   = mapper;
 }
 public TableCliUpdateTaskAsync(IMapper mapper, TaskRequestValidatior validator)
 {
     _tableCli  = new TableCli(AzureStorageConnection.Instance(), "Tasks");;
     _mapper    = mapper;
     _validator = validator;
 }
예제 #9
0
 public TableCliCreateProject(ProjectRequestValidator validator)
 {
     _tableCli  = new TableCli(AzureStorageConnection.Instance(), "Projects");
     _validator = validator;
 }