コード例 #1
0
    public static RemoteAttributeData GetAttributeData(Type type
                                                       , string propertyName)
    {
        //this is where you are going to implement your logic im just implementing                 as an example
        //you can pass in a different type to get your values. For example you can  pass in a service to get required values.

        //property specific logic here, again im going to implement to make this
        //specification by example
        var attrData = new RemoteAttributeData();

        if (propertyName == "MyOtherProperty")
        {
            attrData.Action       = "MyOtherPropertyRelatedAction";
            attrData.Controller   = "MyOtherPropertyRelatedController";
            attrData.ErrorMessage = "MyOtherPropertyRelated Error Message";
            attrData.HttpMethod   = "POST";
        }
        else
        {
            attrData.Action       = "UserNameExists";
            attrData.Controller   = "AccountController";
            attrData.ErrorMessage = "Some Error Message";
            attrData.HttpMethod   = "POST";
        }
        return(attrData);
    }
コード例 #2
0
    public static RemoteAttributeData GetAttributeData(Type type)
    {
        //this is where you are going to implement your logic im just implementing as an example
        //you can pass in a different type to get your values. For example you can pass in a service to get required values.
        var attrData = new RemoteAttributeData();

        attrData.Action       = "UserNameExists";
        attrData.Controller   = "AccountController";
        attrData.ErrorMessage = "Some Error Message";
        attrData.HttpMethod   = "POST";
        return(attrData);
    }