public async Task <ActionResult> ContactPost(string providerCode, OrganisationViewModelForContact model) { var providerEnrichmentGetModel = await _manageApi.GetProviderEnrichment(providerCode); var enrichmentModel = providerEnrichmentGetModel?.EnrichmentModel; ValidateContactModel(model); if (!ModelState.IsValid) { return(View("Contact", model)); } if (enrichmentModel == null && model.IsEmpty()) { // Draft state is "New" and no changes have been made - don't insert a draft return(RedirectToAction("Details", "Organisation", new { providerCode = providerCode })); } model.MergeIntoEnrichmentModel(ref enrichmentModel); var result = await SaveValidatedOrgansation(enrichmentModel, providerCode); return(result); }
public void ValidateContactModel(OrganisationViewModelForContact model) { ModelState.Clear(); TryValidateModel(model); }