Last active
November 24, 2019 10:36
-
-
Save sreekrishnan1993/262a75336e3d881ea609d70745e72df1 to your computer and use it in GitHub Desktop.
SetFieldValueSubmitAction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override bool Execute(string data, FormSubmitContext formSubmitContext) | |
{ | |
Assert.ArgumentNotNull((object)formSubmitContext, nameof(formSubmitContext)); | |
var formData = formSubmitContext.Fields; | |
//Get the data from other fields | |
//Hidden Field created for getting the status | |
var statusField = formData.Where(x => x.Name == "Status").FirstOrDefault(); | |
//Post the data from other fields to any services or third party providers to get the status | |
var result = "POST THE DATA TO THE THIRD PARTY PROVIDER AND GET THE RESULT"; | |
SetValue(statusField, result); | |
} | |
public static void SetValue(IViewModel postedField, string value) | |
{ | |
Assert.ArgumentNotNull((object)postedField, "postedField"); | |
var valueField = postedField as IValueField; | |
var property = postedField.GetType().GetProperty("Value"); | |
property.SetValue((object)postedField, (object)value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment