asp.net mvc - ModelState is coming false even when I've modified the property in action filter -
Text after "itemprop =" text ">
I have modified the ActionType itself in the following action filters but still getting the model state error as" Field ActionType Regular Expression '1 | 2 | 3 | 4'. "
As for My ActionType Enum is action filter You use the regular expression instead of the range to change the data annotation on the ActionType property Can you? ? [Regular Expression (" 1 | 2) | 3 | 4 ")] Public Ent Action Type {get; Set; }
public enum ActionType {pair = 1, update = 2, delete = 3, find = 4}
public override is zero OnActionExecuting (System.Web.Http.Controllers.HttpActionContext actionContext) {var formData = actionContext.ActionArguments.FirstOrDefault (). Value EntityBase; If (formData! = Null) {string methodType = actionContext.Request.Method.Method; Switch (methodType.ToUpper ()) {case "POST": formData.ActionType = (int) ActionType.Add; break; Case "PUT": formData.ActionType = (int) ActionType.Update; break; Case "DELETE": formData.ActionType = (int) ActionType.Delete; break; Case "Received": formData.ActionType = (At) Action Tap Search; break; // your errors}} base.OnActionExecuting (actionContext); } Text after "
[Category (1, 4)] Public Ent Action Type {get; Set; }
Comments
Post a Comment