Skip to content

Instantly share code, notes, and snippets.

@sreekrishnan1993
Last active November 24, 2019 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sreekrishnan1993/262a75336e3d881ea609d70745e72df1 to your computer and use it in GitHub Desktop.
Save sreekrishnan1993/262a75336e3d881ea609d70745e72df1 to your computer and use it in GitHub Desktop.
SetFieldValueSubmitAction
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