Exemple #1
0
        public static string GetLoadContactsUrl(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            return(contactOptionsViewModel.GetLoadContactsUrl(urlHelper, contactOptionsViewModel.Filter, contactOptionsViewModel.ExternalIdentifier));
        }
Exemple #2
0
        public static string GetStartCreatingContactUrl(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            return(urlHelper.AbsoluteAction("StartCreatingContact", "Contact", new { CountryCode = "{countryCode}" }));
        }
Exemple #3
0
        public static string GetAddAssociatedCompanyUrl(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            return(urlHelper.AbsoluteAction("AddAssociatedCompany", "Contact", new { CountryCode = contactOptionsViewModel.DefaultCountryCode }));
        }
Exemple #4
0
        public static string GetStartLoadingContactsUrl(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper, string filter)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            return(string.IsNullOrWhiteSpace(filter)
                ? urlHelper.AbsoluteAction("StartLoadingContacts", "Contact")
                : urlHelper.AbsoluteAction("StartLoadingContacts", "Contact", new { Filter = filter }));
        }
Exemple #5
0
        public static string GetStartLoadingContactUrlForExternalIdentifier(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            if (string.IsNullOrWhiteSpace(contactOptionsViewModel.ExternalIdentifier))
            {
                return(null);
            }

            ContactIdentificationViewModel contactIdentificationViewModel = new ContactIdentificationViewModel
            {
                ExternalIdentifier = contactOptionsViewModel.ExternalIdentifier
            };

            return(contactIdentificationViewModel.GetStartLoadingContactUrl(urlHelper));
        }
Exemple #6
0
        public static string GetLoadContactsUrl(this ContactOptionsViewModel contactOptionsViewModel, IUrlHelper urlHelper, string filter, string externalIdentifier)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel))
            .NotNull(urlHelper, nameof(urlHelper));

            if (string.IsNullOrWhiteSpace(filter) == false && string.IsNullOrWhiteSpace(externalIdentifier) == false)
            {
                return(urlHelper.AbsoluteAction("LoadContacts", "Contact", new { Filter = filter, ExternalIdentifier = externalIdentifier }));
            }

            if (string.IsNullOrWhiteSpace(filter) == false && string.IsNullOrWhiteSpace(externalIdentifier))
            {
                return(urlHelper.AbsoluteAction("LoadContacts", "Contact", new { Filter = filter }));
            }

            if (string.IsNullOrWhiteSpace(filter) && string.IsNullOrWhiteSpace(externalIdentifier) == false)
            {
                return(urlHelper.AbsoluteAction("LoadContacts", "Contact", new { ExternalIdentifier = externalIdentifier }));
            }

            return(urlHelper.AbsoluteAction("LoadContacts", "Contact"));
        }
Exemple #7
0
        public static IEnumerable <SelectListItem> GetCountryItems(this ContactOptionsViewModel contactOptionsViewModel)
        {
            NullGuard.NotNull(contactOptionsViewModel, nameof(contactOptionsViewModel));

            return(contactOptionsViewModel.Countries?.Select(countryViewModel => new SelectListItem(countryViewModel.Name, countryViewModel.Code)).ToArray() ?? new SelectListItem[0]);
        }