public ActionResult Solutions()
        {
            var solutionsNames = new[] { "dlja-servernyh-komnat-i-6kafov", "udaljonnoe-upravlenie-jelektropitaniem", "re6enija-na-osnove-POE" };
            var model          = new ProductsModel
            {
                ActiveSection =
                    NavigationProvider.GetAllSections().First(s => s.Url == "solutions")
            };
            var devices = new List <Device>();

            foreach (var solutionName in solutionsNames)
            {
                var sub = _repository.Devices.FirstOrDefault(d => d.Url == solutionName);
                if (sub != null)
                {
                    devices.AddRange(_repository.Devices.Where(d => !d.Name.IsGroup() && d.Name.IsUnderOther(sub.Name)));
                }
            }

            model.Devices = devices;
            model.ActiveSection.IsSelected = true;
            var sections = NavigationProvider.GetAllSections().Where(m => m.Url != model.ActiveSection.Url);

            sections.ForEach(m => model.Sections.Add(m));


            //return View(model);

            return(View("Adaptive_Index", model));
        }
        public ActionResult Development()
        {
            var devices = _repository.Devices.Where(d => !d.Name.IsGroup() && d.Name.Path.Contains("Development"));

            var model = new ProductsModel
            {
                ActiveSection =
                    NavigationProvider.GetAllSections().FirstOrDefault(m => m.Url == "development")
            };

            ViewBag.Title = ViewBag.Description = ViewBag.Keywords = model.ActiveSection.FormattedTitle;

            model.Devices = devices;

            return(View("Adaptive_Index", model));
        }
        public ActionResult UserGuide(string id, string page)
        {
            ViewBag.Posts   = NetpingHelpers.Helpers.GetTopPosts();
            ViewBag.Devices = NetpingHelpers.Helpers.GetNewDevices();

            var sections = NavigationProvider.GetAllSections();
            var devices  = _repository.Devices.Where(d => !d.Name.IsGroup());

            UserManualViewModel model = null;

            try
            {
                var guide =
                    _repository.GetUserManual(id.Replace(".", "%2E").Replace("!2F", "%2F"));
                if (guide != null)
                {
                    model = new UserManualViewModel
                    {
                        Id     = guide.Id,
                        Title  = guide.Title.Replace("%2E", "."),
                        Name   = guide.Name,
                        Pages  = guide.Pages.OrderBy(p => p.Title, new NaturalComparer(CultureInfo.CurrentCulture)),
                        ItemId = guide.ItemId
                    };

                    Device device = null;
                    if (model.ItemId > 0)
                    {
                        device = devices.FirstOrDefault(d => d.SFiles.Any(sf => sf.Id == model.ItemId));
                    }
                    else
                    {
                        device = devices.FirstOrDefault(d => d.SFiles.Any(f => id.Contains(f.Title)));
                    }
                    var group =
                        _repository.Devices.FirstOrDefault(
                            d =>
                            d.Name.IsGroup() && d.Name.IsIncludeOther(device.Name) &&
                            !string.IsNullOrEmpty(d.Url));
                    var section = sections.FirstOrDefault(s => s.Url == group.Url);

                    model.Device  = device;
                    model.Section = section ?? new SectionModel
                    {
                        Title = "Other",
                        Url   = "/"
                    };

                    if (string.IsNullOrEmpty(page))
                    {
                        return(View("~/Views/Products/UserGuide.cshtml", model));
                    }
                    else
                    {
                        var m = guide.Pages.SingleOrDefault(p => p.Title.Contains(page.Replace(".", "%2E")));
                        Session["page"] = m;
                        return(View("~/Views/Products/UserGuidePage.cshtml", m));
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(View("~/Views/Products/UserGuide.cshtml", model));
        }
        public ActionResult Index(string group, string id)
        {
            var devices = _repository.Devices.Where(d => !d.Name.IsGroup());
            var groups  = _repository.Devices.Where(d => d.Name.IsGroup());

            if (group == null)
            {
                return(HttpNotFound());
            }
            var g = _repository.Devices.FirstOrDefault(d => d.Url == @group);

            if (g != null)
            {
                if (!g.Name.IsGroup())
                {
                    return(Device_view(group));                    // Open device page
                }
                devices = devices.Where(d => !d.Name.IsGroup() && d.Name.IsUnderOther(g.Name));
            }
            else
            {
                return(HttpNotFound());
            }

            ViewBag.Title       = g.Name.Name;
            ViewBag.Description = g.Name.Name;
            ViewBag.Keywords    = g.Name.Name;

            var model = new ProductsModel
            {
                ActiveSection =
                    NavigationProvider.GetAllSections().FirstOrDefault(m => m.Url == @group)
            };


            if (!string.IsNullOrEmpty(id))
            {
                var sub = _repository.Devices.FirstOrDefault(d => d.Url == id);
                if (sub != null)
                {
                    devices = _repository.Devices.Where(d => !d.Name.IsGroup() && d.Name.IsUnderOther(sub.Name));

                    ViewBag.Title       = sub.Name.Name;
                    ViewBag.Description = sub.Name.Name;
                    ViewBag.Keywords    = sub.Name.Name;
                }
                else
                {
                    return(HttpNotFound());
                }
                model.ActiveSection = model.ActiveSection.Sections.First(m => m.Url == id);
            }
            else
            {
                model.ActiveSection.Sections.First().IsSelected = true;
            }
            model.Devices = devices.Where(d => !d.IsInArchive);
            model.ActiveSection.IsSelected = true;
            var sections = NavigationProvider.GetAllSections().Where(m => m.Url != model.ActiveSection.Url);

            sections.ForEach(m => model.Sections.Add(m));


            //return View(model);

            return(View("Adaptive_Index", model));
        }