protected override void Validate() { var invalidProperties = new List <string>(); var columnNames = ColumnNames; foreach (var property in DbRequest.Properties()) { var propertyName = Database.ToDbCase(property.Name); if (columnNames.Contains(propertyName)) { if (!Columns.Any(q => q.IsReadonly && q.ColumnName == propertyName)) { DbRequest[propertyName] = property.Value; DbToJsonName[propertyName] = propertyName; } else { Response.AddError(DbToJsonName[property.Name], Database.ErrorMessages.ReadonlyProperty); } } else { invalidProperties.Add(property.Name); } } if (invalidProperties.Count == 0) { return; } Response.SetBadRequestError(Database.ErrorMessages.InvalidProperties(string.Join(", ", invalidProperties))); Response.Continue = false; }
protected override void Validate() { var columnNames = Columns.Where(q => q.IsRequired).Select(s => s.ColumnName); foreach (var property in DbRequest.Properties()) { if (columnNames.Contains(property.Name) && string.IsNullOrWhiteSpace(property.Value <string>())) { Response.AddError(DbToJsonName[property.Name], Database.ErrorMessages.Required); } } }