Пример #1
0
        public async Task <IActionResult> UserDetails()
        {
            var account = await HttpContext.GetLoggedInUser();

            if (account == null)
            {
                return(Redirect("Index"));
            }

            var clientResponse = await _eventiApi.GetClientAsync(new ClientSearchRequest()
            {
                AccountID = account.ID
            });

            var client = clientResponse.Content.Data.ToList()[0];


            if (client == null)
            {
                return(Redirect("Index"));
            }

            ClientDetailsVM model = new ClientDetailsVM
            {
                ID          = client.ID,
                Address     = client.Address,
                Email       = client.Email,
                FirstName   = client.FirstName,
                LastName    = client.LastName,
                PhoneNumber = client.PhoneNumber,
                Image       = client.Image
            };

            var countryResponse = await _eventiApi.GetCountryAsync();

            model.Countries = countryResponse.Content.Data.ToList()
                              .Select(i => new SelectListItem {
                Text  = i.Name,
                Value = i.ID.ToString()
            })
                              .ToList();

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> Registration()
        {
            var countriesResponse = await _eventiApi.GetCountryAsync();

            var citiesResponse = await _eventiApi.GetCityAsync();

            var countries = countriesResponse.Content.Data
                            .Select
                            (
                i => new SelectListItem()
            {
                Value = i.ID.ToString(),
                Text  = i.Name
            }
                            )
                            .ToList();

            var cities = citiesResponse.Content.Data
                         .Select
                         (
                i => new SelectListItem()
            {
                Value = i.ID.ToString(),
                Text  = i.Name
            }
                         )
                         .ToList();

            RegistrationVM model = new RegistrationVM()
            {
                Cities    = cities,
                Countries = countries
            };

            return(View(model));
        }