Closed allanwalpy closed 5 years ago
It is now:
public class VacancyUpdateModel { [ValidUpdateField(typeof(ValidVacancyTitleAttribute))] public UpdateCommandModel<string> Title { get; set; } [ValidUpdateField(typeof(ValidVacancyDescriptionAttribute))] public UpdateCommandModel<string> Description { get; set; } [ValidUpdateField(typeof(ValidEmploymentTypeListAttribute))] public UpdateCommandModel<List<string>> EmploymentType { get; set; } [ValidUpdateField(typeof(ValidSalaryAttribute))] public UpdateCommandModel<decimal?> Salary { get; set; } public UpdateCommandModel<Person> ContactPerson { get; set; } [ValidUpdateField(typeof(ValidPhoneNumberAttribute))] public UpdateCommandModel<string> ContactPhone { get; set; } }
suggestion: if there is no field with such name or it is null (questionable) - do not set it;
workaround: set separate api to reset fields (not advisable);
[AnyNotNull( nameof(Title), nameof(Description), nameof(EmploymentType), nameof(Salary), nameof(ContactPerson), nameof(ContactPhone))] public class VacancyUpdateModel { [ValidVacancyTitle] public string Title { get; set; } [ValidVacancyDescription] public string Description { get; set; } [ValidEmploymentTypeList] public List<string> EmploymentType { get; set; } [ValidVacancySalary] public decimal? Salary { get; set; } public Person ContactPerson { get; set; } [ValidPhoneNumber] public string ContactPhone { get; set; } }
nah
It is now:
suggestion: if there is no field with such name or it is null (questionable) - do not set it;
workaround: set separate api to reset fields (not advisable);