Exemple #1
0
        private async Task CreateOrUpdateProviderQualificationAsync(ProviderVenueQualificationDto providerVenueQualification,
                                                                    int providerVenueId, string postcode, int qualificationId)
        {
            var providerQualificationViewModel =
                await _providerQualificationService.GetProviderQualificationAsync(providerVenueId, qualificationId);

            if (providerQualificationViewModel == null && providerVenueQualification.QualificationIsOffered)
            {
                var addQualificationViewModel = new AddQualificationViewModel
                {
                    LarId           = providerVenueQualification.LarId,
                    QualificationId = qualificationId,
                    Source          = Source,
                    ProviderVenueId = providerVenueId,
                    Postcode        = postcode
                };

                Debug.WriteLine(
                    $">>>> Creating ProviderQualification {addQualificationViewModel.LarId} - {addQualificationViewModel.QualificationId} - {addQualificationViewModel.ProviderVenueId}");
                await _providerQualificationService.CreateProviderQualificationAsync(addQualificationViewModel);
            }
            // Delete Provider Venue Qualification
            else if (providerQualificationViewModel != null && !providerVenueQualification.QualificationIsOffered)
            {
                Debug.WriteLine(
                    $">>>> Removing ProviderQualification {providerVenueId} - {qualificationId} ({providerQualificationViewModel.ProviderVenueId} - {providerQualificationViewModel.QualificationId})");
                await _providerQualificationService.RemoveProviderQualificationAsync(providerVenueId, qualificationId);
            }
        }
        public async Task <IActionResult> RemoveQualificationAsync(int providerVenueId, int qualificationId)
        {
            await _providerQualificationService.RemoveProviderQualificationAsync(providerVenueId, qualificationId);

            return(RedirectToRoute("GetProviderVenueDetail", new { providerVenueId }));
        }