I would like to know if there's a way to force the value of some properties to always be lowercase or uppercase when I receive the model at my controller. Preferably in a clean way, like using attributes.
Example:
Controller:
[HttpPost]
public async Task<Model> Post(Model model)
{
//Here properties with the attribute [LowerCase] (Prop2 in this case) should be lowercase.
}
Model:
public class Model
{
public string Prop1 { get; set; }
[LowerCase]
public string Prop2 { get; set; }
}
I've heard that changing values with a custom ValidationAttribute is not a good thing. Also decided to create a custom DataBinder, but didn't find exactly how I should implement it, when tried to, just received null in my controller.