public string AdjustUrl(TreeNode <NavigationNode> node)
        {
            string urlToUse = string.Empty;

            if ((node.Value.Action.Length > 0) && (node.Value.Controller.Length > 0))
            {
                if (node.Value.PreservedRouteParameters.Length > 0)
                {
                    List <string> preservedParams = node.Value.PreservedRouteParameters.SplitOnChar(',');
                    //var queryBuilder = new QueryBuilder();
                    //var routeParams = new { };
                    var queryStrings = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                    foreach (string p in preservedParams)
                    {
                        if (context.Request.Query.ContainsKey(p))
                        {
                            queryStrings.Add(p, context.Request.Query[p]);
                        }
                    }

                    urlToUse = urlHelper.Action(node.Value.Action, node.Value.Controller);
                    if ((urlToUse != null) && (queryStrings.Count > 0))
                    {
                        urlToUse = QueryHelpers.AddQueryString(urlToUse, queryStrings);
                    }
                }
                else
                {
                    urlToUse = urlHelper.Action(node.Value.Action, node.Value.Controller);
                }
            }

            string key = NavigationNodeAdjuster.KeyPrefix + node.Value.Key;

            if (context.Items[key] != null)
            {
                NavigationNodeAdjuster adjuster = (NavigationNodeAdjuster)context.Items[key];
                if (adjuster.ViewFilterName == navigationFilterName)
                {
                    if (adjuster.AdjustedUrl.Length > 0)
                    {
                        return(adjuster.AdjustedUrl);
                    }
                }
            }

            if (string.IsNullOrEmpty(urlToUse))
            {
                return(node.Value.Url);
            }

            //if(urlToUse.Length > 0) { return urlToUse; }

            return(urlToUse);
        }
        private bool IsAllowedByAdjuster(TreeNode <NavigationNode> node)
        {
            string key = NavigationNodeAdjuster.KeyPrefix + node.Value.Key;

            if (context.Items[key] != null)
            {
                NavigationNodeAdjuster adjuster = (NavigationNodeAdjuster)context.Items[key];
                if (adjuster.ViewFilterName == navigationFilterName)
                {
                    if (adjuster.AdjustRemove)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        public string AdjustText(TreeNode <NavigationNode> node)
        {
            string key = NavigationNodeAdjuster.KeyPrefix + node.Value.Key;

            if (context.Items[key] != null)
            {
                NavigationNodeAdjuster adjuster = (NavigationNodeAdjuster)context.Items[key];
                if (adjuster.ViewFilterName == navigationFilterName)
                {
                    if (adjuster.AdjustedText.Length > 0)
                    {
                        return(adjuster.AdjustedText);
                    }
                }
            }

            return(node.Value.Text);
        }
Ejemplo n.º 4
0
        public async Task<IActionResult> CountryEdit(
            Guid? guid,
            int returnPageNumber = 1,
            bool partial = false)
        {
            ViewBag.Title = "Edit Country";

            GeoCountryViewModel model;

            if ((guid != null) && (guid.Value != Guid.Empty))
            {
                IGeoCountry country = await dataManager.FetchCountry(guid.Value);
                model = GeoCountryViewModel.FromIGeoCountry(country);

                NavigationNodeAdjuster currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "CountryEdit";
                currentCrumbAdjuster.AdjustedText = "Edit Country";
                currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
                currentCrumbAdjuster.AddToContext();

               
            }
            else
            {
                ViewBag.Title = "New Country";
                model = new GeoCountryViewModel();
            }

            model.ReturnPageNumber = returnPageNumber;


            if (partial)
            {
                return PartialView("CountryEditPartial", model);
            }

            return View(model);

        }
Ejemplo n.º 5
0
        public async Task<IActionResult> StateListPage(
            Guid? countryGuid,
            int pageNumber = 1,
            int pageSize = -1,
            int crp = 1,
            bool ajaxGrid = false,
            bool partial = false)
        {
            if (!countryGuid.HasValue)
            {
                return RedirectToAction("CountryListPage");
            }

            ViewBag.Title = "State List Administration";
            int itemsPerPage = uiOptions.DefaultPageSize_StateList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }

            StateListPageViewModel model = new StateListPageViewModel();

            IGeoCountry country = await dataManager.FetchCountry(countryGuid.Value);
            model.Country = GeoCountryViewModel.FromIGeoCountry(country);
            model.States = await dataManager.GetGeoZonePage(countryGuid.Value, pageNumber, itemsPerPage);

            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = await dataManager.GetGeoZoneCount(countryGuid.Value);
            model.CountryListReturnPageNumber = crp;

            // below we are just manipiulating the bread crumbs
            NavigationNodeAdjuster currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            currentCrumbAdjuster.KeyToAdjust = "StateListPage";
            currentCrumbAdjuster.AdjustedText = model.Country.Name + " States";
            currentCrumbAdjuster.AdjustedUrl = Request.Path.ToString()
                + "?countryGuid=" + country.Guid.ToString()
                + "&crp=" + crp.ToInvariantString();
            currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
            currentCrumbAdjuster.AddToContext();

            NavigationNodeAdjuster countryListCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            countryListCrumbAdjuster.KeyToAdjust = "CountryListPage";
            countryListCrumbAdjuster.AdjustedUrl = Request.Path.ToString().Replace("StateListPage", "CountryListPage")
                + "?pageNumber=" + crp.ToInvariantString(); 
            countryListCrumbAdjuster.AddToContext();
            
            if (ajaxGrid)
            {
                return PartialView("StateListGridPartial", model);
            }

            if (partial)
            {
                return PartialView("StateListPagePartial", model);
            }


            return View(model);

        }
Ejemplo n.º 6
0
        public async Task<IActionResult> StateEdit(
            Guid countryGuid,
            Guid? guid,
            int crp = 1,
            int returnPageNumber = 1
            )
        {
            if (countryGuid == Guid.Empty)
            {
                return RedirectToAction("CountryListPage");
            }

            //int returnPage = 1;
            //if (returnPageNumber.HasValue) { returnPage = returnPageNumber.Value; }

            ViewBag.Title = "Edit State";

            GeoZoneViewModel model;

            if ((guid.HasValue) && (guid.Value != Guid.Empty))
            {
                IGeoZone state = await dataManager.FetchGeoZone(guid.Value);
                if ((state != null) && (state.CountryGuid == countryGuid))
                {
                    model = GeoZoneViewModel.FromIGeoZone(state);
                    model.Heading = "Edit State";

                }
                else
                {
                    // invalid guid provided
                    return RedirectToAction("CountryListPage", new { pageNumber = crp });
                }

            }
            else
            {
                model = new GeoZoneViewModel();
                model.Heading = "Create New State";
                model.CountryGuid = countryGuid;
            }

            model.ReturnPageNumber = returnPageNumber;
            model.CountryListReturnPageNumber = crp;

            IGeoCountry country = await dataManager.FetchCountry(countryGuid);
            model.Country = GeoCountryViewModel.FromIGeoCountry(country);

            NavigationNodeAdjuster currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            currentCrumbAdjuster.KeyToAdjust = "StateEdit";
            currentCrumbAdjuster.AdjustedText = model.Heading;
            currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
            currentCrumbAdjuster.AddToContext();

            //var node = SiteMaps.Current.FindSiteMapNodeFromKey("StateEdit");
            //if (node != null)
            //{
            //    node.Title = model.Heading;
            //    var parent = node.ParentNode;
            //    if (parent != null)
            //    {
            //        parent.Title = model.Country.Name + " States";

            //    }
            //}

            return View(model);

        }
Ejemplo n.º 7
0
        public string AdjustUrl(TreeNode <NavigationNode> node)
        {
            string urlToUse = string.Empty;

            try
            {
                var routeValues = new Dictionary <string, object>();
                routeValues.Add("area", node.Value.Area);
                if (!string.IsNullOrWhiteSpace(node.Value.PreservedRouteParameters))
                {
                    List <string> preservedParams = node.Value.PreservedRouteParameters.SplitOnChar(',');
                    foreach (string p in preservedParams)
                    {
                        if (urlHelper.ActionContext.RouteData.Values.ContainsKey(p))
                        {
                            routeValues.Add(p, urlHelper.ActionContext.RouteData.Values[p]);
                        }
                        else if (context.Request.Query.ContainsKey(p))
                        {
                            routeValues.Add(p, context.Request.Query[p]);
                        }
                    }
                }

                if ((!string.IsNullOrWhiteSpace(node.Value.Action)) && (!string.IsNullOrWhiteSpace(node.Value.Controller)))
                {
                    urlToUse = urlHelper.Action(node.Value.Action, node.Value.Controller, routeValues);
                }
                else if (!string.IsNullOrWhiteSpace(node.Value.NamedRoute))
                {
                    urlToUse = urlHelper.RouteUrl(node.Value.NamedRoute, routeValues);
                }
                else if (!string.IsNullOrWhiteSpace(node.Value.Page))
                {
                    urlToUse = urlHelper.Page(node.Value.Page, routeValues);
                }

                string key = NavigationNodeAdjuster.KeyPrefix + node.Value.Key;

                if (context.Items[key] != null)
                {
                    NavigationNodeAdjuster adjuster = (NavigationNodeAdjuster)context.Items[key];
                    if (adjuster.ViewFilterName == navigationFilterName)
                    {
                        if (!string.IsNullOrWhiteSpace(adjuster.AdjustedUrl))
                        {
                            return(adjuster.AdjustedUrl);
                        }
                    }
                }

                if (string.IsNullOrEmpty(urlToUse))
                {
                    return(node.Value.Url);
                }
            }
            catch (ArgumentOutOfRangeException ex)
            {
                log.LogError("error handled for " + node.Value.Key, ex);
            }



            return(urlToUse);
        }
Ejemplo n.º 8
0
        //[Authorize(Roles = "Admins")]
        public async Task<ActionResult> UserEdit(
            int userId,
            Guid? siteGuid
            )
        {
            ISiteSettings selectedSite;
            // only server admin site can edit other sites settings
            if ((siteGuid.HasValue) && (siteGuid.Value != Guid.Empty) && (siteGuid.Value != siteManager.CurrentSite.SiteGuid) && (siteManager.CurrentSite.IsServerAdminSite))
            {
                selectedSite = await siteManager.Fetch(siteGuid.Value);
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, "{0} - Manage User", selectedSite.SiteName);
            }
            else
            {
                selectedSite = siteManager.CurrentSite;
                ViewData["Title"] = "Manage User";
            }
            

            EditUserViewModel model = new EditUserViewModel();
            model.SiteGuid = selectedSite.SiteGuid;
            
            ISiteUser user = await UserManager.Fetch(selectedSite.SiteId, userId);
            if (user != null)
            {
                model.UserId = user.UserId;
                model.UserGuid = user.UserGuid;
                model.Email = user.Email;
                model.FirstName = user.FirstName;
                model.LastName = user.LastName;
                model.LoginName = user.UserName;
                model.DisplayName = user.DisplayName;

                model.AccountApproved = user.AccountApproved;
                model.Comment = user.Comment;
                model.EmailConfirmed = user.EmailConfirmed;
                model.IsLockedOut = user.IsLockedOut;
                model.LastLoginDate = user.LastLoginDate;
                model.TimeZoneId = user.TimeZoneId;
           
                if (user.DateOfBirth > DateTime.MinValue)
                {
                    model.DateOfBirth = user.DateOfBirth;
                }

                
                NavigationNodeAdjuster currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "UserEdit";
                currentCrumbAdjuster.AdjustedText = user.DisplayName;
                currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
                currentCrumbAdjuster.AddToContext();
                
            }

            return View(model);

        }
Ejemplo n.º 9
0
        public async Task<IActionResult> CountryEdit(
            Guid? countryId,
            int returnPageNumber = 1
            )
        {
            GeoCountryViewModel model;
            if ((countryId != null) && (countryId.Value != Guid.Empty))
            {
                ViewData["Title"] = sr["Edit Country"];
                var country = await dataManager.FetchCountry(countryId.Value);
                model = GeoCountryViewModel.FromIGeoCountry(country);

                var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "CountryEdit";
                currentCrumbAdjuster.AdjustedText = sr["Edit Country"];
                currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
                currentCrumbAdjuster.AddToContext();
            }
            else
            {
                ViewData["Title"] = sr["New Country"];
                model = new GeoCountryViewModel();
            }

            model.ReturnPageNumber = returnPageNumber;
            
            return View(model);
        }
Ejemplo n.º 10
0
        public async Task<IActionResult> EditClient(
            Guid? siteId,
            string clientId = null)
        {
            
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);

            if (!string.IsNullOrEmpty(clientId))
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - Edit Client"], selectedSite.SiteName);
            }

            var model = new ClientEditViewModel();
            model.SiteId = selectedSite.Id.ToString();
            model.NewClient.SiteId = model.SiteId;
            if (!string.IsNullOrEmpty(clientId))
            {
                var client = await clientsManager.FetchClient(model.SiteId, clientId);
                model.CurrentClient = new ClientItemViewModel(model.SiteId, client);
            }

            if (model.CurrentClient == null)
            { 
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - New Client"], selectedSite.SiteName);
                var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "EditClient";
                currentCrumbAdjuster.AdjustedText = sr["New Client"];
                currentCrumbAdjuster.AddToContext();
            }
            

            return View(model);

        }
Ejemplo n.º 11
0
        public async Task<IActionResult> StateEdit(
            Guid countryId,
            Guid? stateId,
            int crp = 1,
            int returnPageNumber = 1
            )
        {
            if (countryId == Guid.Empty)
            {
                return RedirectToAction("CountryListPage");
            }
            
            GeoZoneViewModel model;

            if ((stateId.HasValue) && (stateId.Value != Guid.Empty))
            {
                var state = await dataManager.FetchGeoZone(stateId.Value);
                if ((state != null) && (state.CountryId == countryId))
                {
                    model = GeoZoneViewModel.FromIGeoZone(state);

                    var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                    currentCrumbAdjuster.KeyToAdjust = "StateEdit";
                    currentCrumbAdjuster.AdjustedText = model.Name;
                    currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
                    currentCrumbAdjuster.AddToContext();
                }
                else
                {
                    // invalid guid provided
                    return RedirectToAction("CountryListPage", new { pageNumber = crp });
                }

            }
            else
            {
                model = new GeoZoneViewModel();
                model.CountryId = countryId;
            }

            model.ReturnPageNumber = returnPageNumber;
            model.CountryListReturnPageNumber = crp;

            var country = await dataManager.FetchCountry(countryId);
            model.CountryName = country.Name;

            var stateListCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            stateListCrumbAdjuster.KeyToAdjust = "StateListPage";
            stateListCrumbAdjuster.AdjustedText = string.Format(sr["{0} States"], model.CountryName);
            stateListCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
            stateListCrumbAdjuster.AddToContext();
            
            return View(model);

        }
Ejemplo n.º 12
0
        public async Task<IActionResult> StateListPage(
            Guid? countryId,
            int pageNumber = 1,
            int pageSize = -1,
            int crp = 1 
            )
        {
            if (!countryId.HasValue)
            {
                return RedirectToAction("CountryListPage");
            }
            
            var itemsPerPage = uiOptions.DefaultPageSize_StateList;
            if (pageSize > 0)
            {
                itemsPerPage = pageSize;
            }

            var model = new StateListPageViewModel();

            var country = await dataManager.FetchCountry(countryId.Value);
            model.Country = GeoCountryViewModel.FromIGeoCountry(country);
            model.States = await dataManager.GetGeoZonePage(countryId.Value, pageNumber, itemsPerPage);

            model.Paging.CurrentPage = pageNumber;
            model.Paging.ItemsPerPage = itemsPerPage;
            model.Paging.TotalItems = await dataManager.GetGeoZoneCount(countryId.Value);
            model.CountryListReturnPageNumber = crp;

            // below we are just manipiulating the bread crumbs
            var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            currentCrumbAdjuster.KeyToAdjust = "StateListPage";
            currentCrumbAdjuster.AdjustedText = string.Format(sr["{0} States"], model.Country.Name);
            currentCrumbAdjuster.AdjustedUrl = Request.Path.ToString()
                + "?countryId=" + country.Id.ToString()
                + "&crp=" + crp.ToInvariantString();
            currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
            currentCrumbAdjuster.AddToContext();

            var countryListCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
            countryListCrumbAdjuster.KeyToAdjust = "CountryListPage";
            countryListCrumbAdjuster.AdjustedUrl = Request.Path.ToString().Replace("StateListPage", "CountryListPage")
                + "?pageNumber=" + crp.ToInvariantString(); 
            countryListCrumbAdjuster.AddToContext();
            
            return View(model);
        }
Ejemplo n.º 13
0
        public async Task<IActionResult> EditScope(
            Guid? siteId,
            string scopeName = null)
        {
            
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);
            
            if (!string.IsNullOrEmpty(scopeName))
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - Edit Scope"], selectedSite.SiteName);
            }

            var model = new ScopeEditViewModel();
            model.SiteId = selectedSite.Id.ToString();
            model.NewScope.SiteId = model.SiteId;
            if (!string.IsNullOrEmpty(scopeName))
            {
                var scope = await scopesManager.FetchScope(model.SiteId, scopeName);
                model.CurrentScope = scope;
            }

            if(model.CurrentScope == null)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - New Scope"], selectedSite.SiteName);
                var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "EditScope";
                currentCrumbAdjuster.AdjustedText = sr["New Scope"];
                currentCrumbAdjuster.AddToContext();
            }
            else
            {
                model.NewScopeClaim.SiteId = model.SiteId;
                model.NewScopeClaim.ScopeName = model.CurrentScope.Name;
                model.NewScopeSecret.SiteId = model.SiteId;
                model.NewScopeSecret.ScopeName = model.CurrentScope.Name;
            }
            
            return View(model);

        }
Ejemplo n.º 14
0
        public string AdjustUrl(TreeNode <NavigationNode> node)
        {
            string urlToUse = string.Empty;

            try
            {
                if ((!string.IsNullOrWhiteSpace(node.Value.Action)) && (!string.IsNullOrWhiteSpace(node.Value.Controller)))
                {
                    if (!string.IsNullOrWhiteSpace(node.Value.PreservedRouteParameters))
                    {
                        List <string> preservedParams = node.Value.PreservedRouteParameters.SplitOnChar(',');
                        //var queryBuilder = new QueryBuilder();
                        //var routeParams = new { };
                        var queryStrings = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                        foreach (string p in preservedParams)
                        {
                            if (context.Request.Query.ContainsKey(p))
                            {
                                queryStrings.Add(p, context.Request.Query[p]);
                            }
                        }

                        urlToUse = urlHelper.Action(node.Value.Action, node.Value.Controller, new { area = node.Value.Area });

                        if ((urlToUse != null) && (queryStrings.Count > 0))
                        {
                            urlToUse = QueryHelpers.AddQueryString(urlToUse, queryStrings);
                        }
                    }
                    else
                    {
                        urlToUse = urlHelper.Action(node.Value.Action, node.Value.Controller, new { area = node.Value.Area });
                    }
                }
                else if (!string.IsNullOrWhiteSpace(node.Value.NamedRoute))
                {
                    urlToUse = urlHelper.RouteUrl(node.Value.NamedRoute);
                }
                else if (!string.IsNullOrWhiteSpace(node.Value.Page))
                {
                    urlToUse = urlHelper.Page(node.Value.Page, new { area = node.Value.Area });
                }

                string key = NavigationNodeAdjuster.KeyPrefix + node.Value.Key;

                if (context.Items[key] != null)
                {
                    NavigationNodeAdjuster adjuster = (NavigationNodeAdjuster)context.Items[key];
                    if (adjuster.ViewFilterName == navigationFilterName)
                    {
                        if (!string.IsNullOrWhiteSpace(adjuster.AdjustedUrl))
                        {
                            return(adjuster.AdjustedUrl);
                        }
                    }
                }

                if (string.IsNullOrEmpty(urlToUse))
                {
                    return(node.Value.Url);
                }
            }
            catch (ArgumentOutOfRangeException ex)
            {
                log.LogError("error handled for " + node.Value.Key, ex);
            }



            return(urlToUse);
        }
Ejemplo n.º 15
0
        public async Task<ActionResult> UserEdit(
            Guid userId,
            Guid? siteId
            )
        {
            if(userId == Guid.Empty)
            {
                return RedirectToAction("Index");
            }

            ViewData["ReturnUrl"] = Request.Path + Request.QueryString;
            var selectedSite = await siteManager.GetSiteForDataOperations(siteId);
            // only server admin site can edit other sites settings
            if (selectedSite.Id != siteManager.CurrentSite.Id)
            {
                ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - Manage User"], selectedSite.SiteName);
            }
            else
            {
                ViewData["Title"] = sr["Manage User"];
            }
            
            var model = new EditUserViewModel();
            model.SiteId = selectedSite.Id;
            
            var user = await UserManager.Fetch(selectedSite.Id, userId);
            if (user != null)
            {
                model.UserId = user.Id;
                model.Email = user.Email;
                model.FirstName = user.FirstName;
                model.LastName = user.LastName;
                model.Username = user.UserName;
                model.DisplayName = user.DisplayName;
                model.AccountApproved = user.AccountApproved;
                model.Comment = user.Comment;
                model.EmailConfirmed = user.EmailConfirmed;
                model.IsLockedOut = user.IsLockedOut;
                model.LastLoginDate = user.LastLoginUtc;
                model.TimeZoneId = user.TimeZoneId;
                if(string.IsNullOrEmpty(model.TimeZoneId))
                {
                    model.TimeZoneId = await timeZoneIdResolver.GetSiteTimeZoneId();
                }
                model.AllTimeZones = tzHelper.GetTimeZoneList().Select(x =>
                               new SelectListItem
                               {
                                   Text = x,
                                   Value = x,
                                   Selected = model.TimeZoneId == x
                               });

                if (user.DateOfBirth > DateTime.MinValue)
                {
                    model.DateOfBirth = user.DateOfBirth;
                }

                model.UserClaims = await UserManager.GetClaimsAsync((SiteUser)user);


                var currentCrumbAdjuster = new NavigationNodeAdjuster(Request.HttpContext);
                currentCrumbAdjuster.KeyToAdjust = "UserEdit";
                currentCrumbAdjuster.AdjustedText = user.DisplayName;
                currentCrumbAdjuster.ViewFilterName = NamedNavigationFilters.Breadcrumbs; // this is default but showing here for readers of code 
                currentCrumbAdjuster.AddToContext();
                
            }

            return View(model);
        }