public JsonResult GetJsonIndustry()
        {
            var list = new List <DropDownListViewModel>();

            try
            {
                IList <Industry> IndustryList = _industryRepository.GetAllElements().OrderBy(x => x.IndustryName).ToList();

                if (!object.Equals(IndustryList, null))
                {
                    var industries = IndustryList.ToList();
                    foreach (var item in industries)
                    {
                        list.Add(new DropDownListViewModel
                        {
                            Value = item.IndustryName,
                            Text  = item.IndustryName
                        });
                    }
                }
            }
            catch (HttpException ex)
            {
                throw new HttpException(ex.Message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(Json(new SelectList(list, "Value", "Text"), JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //public async Task<ActionResult> GoToRegister(CompanyLicenseViewModel cModel)
        public async Task <ActionResult> GoToRegister()
        {
            GraphServiceClient graphClient1 = SDKHelper.GetAuthenticatedClient();
            IGraphServiceOrganizationCollectionPage organization = await graphService.GetOrganisationInfo(graphClient1);

            if (organization.Count == 0)
            {
                return(View("~/Views/Shared/GoToLogin.cshtml"));
            }

            GraphServiceClient graphClient2 = SDKHelper.GetAuthenticatedClient();

            // Get the current user's email address.
            //Microsoft.Graph.User me = await graphClient.Me.Request().Select("mail, userPrincipalName, displayName, jobTitle").GetAsync();
            Microsoft.Graph.User me = await graphService.GetUserInfo(graphClient2);

            //me.Mail ?? me.UserPrincipalName;
            string email       = me.Mail ?? me.UserPrincipalName;
            string displayName = me.DisplayName;
            string companyName = organization.CurrentPage[0].DisplayName;
            string website     = organization.CurrentPage[0].VerifiedDomains.ElementAt(0).Name; //me.MySite;
            string jobTitle    = me.JobTitle;

            RegistrationViewModel model = new RegistrationViewModel();

            model.EmailID       = email;
            model.CustomerName  = displayName;
            model.DomainName    = website;
            model.Name          = companyName;
            model.BusinessTitle = jobTitle;
            //model.CustomerType = cModel.CompanyLicenseType;
            model.CustomerType = "Premium";

            ViewBag.PageType = "Register";

            //ViewBag.citieslist = _cityRepository.GetAllElements().Select(x => new SelectListItem
            //{
            //    Value = x.CityName,
            //    Text = x.CityName
            //});


            ViewBag.countrieslist = _cityRepository.GetAllElements().Select(x => new { x.CountryName }).OrderBy(x => x.CountryName).ToList().Distinct().Select(x => new SelectListItem
            {
                Value = x.CountryName,
                Text  = x.CountryName
            });

            ViewBag.industrieslist = _industryRepository.GetAllElements().OrderBy(x => x.IndustryName).ToList().Select(x => new SelectListItem
            {
                Value = x.IndustryName,
                Text  = x.IndustryName
            });

            return(View("~/Views/Registration/Register.cshtml", model));
        }