Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Custom Validation Attribute for model C#

$
0
0

I have a model:

public class SendEmail{    public bool IsScheduled { get; set; }    public DateTime ScheduleDate { get; set; }    public List<ScheduleAttachement> ScheduleAttachement {get; set;}}public class ScheduleAttachement{    public string Name { get; set; }    public string Attachement { get; set; }}

I want to do a custom validation to check if bool IsScheduled == true, ScheduleAttachement must contain a value. If not throw 400 bad request


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>