public static void AddRuleForNotNullOrEmpty <T>( this AbstractOctopostValidator <T> validator, Expression <Func <T, string> > property, OctopostEntityName entity, PropertyName name) { validator.RuleFor(property) .Must(x => !string.IsNullOrEmpty(x)) .WithErrorCode(ErrorCode.Parse( ErrorCodeType.PropertyDataNullOrEmpty, entity, name).Code) .WithMessage($"{name.Name} cannot be null or empty"); }
public static void AddRuleForMinLength <T>( this AbstractOctopostValidator <T> validator, Expression <Func <T, string> > property, int minimumLength, OctopostEntityName entity, PropertyName name) { validator.RuleFor(property) .MinimumLength(minimumLength) .WithErrorCode(ErrorCode.Parse( ErrorCodeType.TooShort, entity, name).Code) .WithMessage($"{name.Name} must be at least {minimumLength} characters long"); }
public ForbiddenApiResult(long userId, OctopostEntityName accessedEntity, long accessedEntityId) { this.UserId = userId; this.AccessedEntityType = accessedEntity; this.AccessedEntityId = accessedEntityId; }
public NotFoundApiResult(OctopostEntityName accessedEntity, long entityId) { this.AccessedEntityType = accessedEntity; this.AccessedEntityId = entityId; this.Message = $"{this.AccessedEntityType.ToString()} does not exist. The owner may have deleted it"; }
public CreatedApiResult(OctopostEntityName createdEntity, long createdId) { this.Entity = createdEntity; this.CreatedId = createdId; }