Reputation: 29
//Here is the sample code in my request class:
[Required]
public long myID { get; set; }
// I am planning to write something in log like this if ever the Required //value is not satisfied:
Response":{"Status":"1","Output":null}}}|
// I wanted to add something like this to my controller:
if (RequiredAttribute.IsDefined)
{
response.Status = "1";
goto Finish;
}
//Finish is the one that runs to write logs
Upvotes: 1
Views: 73
Reputation: 29
Just added Error Message and it automatically write to logs the error(400)
[Required(ErrorMessage = "ID is required")]
public long ID { get; set; }
Upvotes: 1