Exemplo n.º 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));
        }
Exemplo n.º 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}" }));
        }
Exemplo n.º 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 }));
        }
Exemplo n.º 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 }));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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"));
        }
Exemplo n.º 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]);
        }