public async Task <IActionResult> UpdateOrganisationType() { var searchModel = _sessionService.GetSearchResults(); var organisationTypes = _apiClient.GetOrganisationTypes(searchModel.SelectedResult?.ProviderType?.Id).Result.Where(x => x.Id != OrganisationType.Unassigned).OrderBy(x => x.Id); var model = new UpdateOrganisationTypeViewModel { LegalName = searchModel.SelectedResult.LegalName, OrganisationId = searchModel.SelectedResult.Id, OrganisationTypeId = searchModel.SelectedResult.OrganisationType.Id, OrganisationTypes = organisationTypes, ProviderTypeId = searchModel.SelectedResult.ProviderType.Id }; return(View("~/Views/Roatp/UpdateOrganisationType.cshtml", model)); }
public async Task <IActionResult> UpdateType(UpdateOrganisationTypeViewModel model) { model.OrganisationTypes = _apiClient.GetOrganisationTypes(model.ProviderTypeId).Result.Where(x => x.Id != OrganisationType.Unassigned).OrderBy(x => x.Id); if (!ModelState.IsValid) { return(View("~/Views/Roatp/UpdateOrganisationType.cshtml", model)); } model.UpdatedBy = HttpContext.User.UserDisplayName(); var request = Mapper.Map <UpdateOrganisationTypeRequest>(model); var result = await _apiClient.UpdateOrganisationType(request); if (result) { return(await RefreshSearchResults()); } return(View("~/Views/Roatp/UpdateOrganisationType.cshtml", model)); }