public CompanyNavigationView()
 {
     InitializeComponent();
     DataContext = new CompanyNavigationViewModel();
 }
예제 #2
0
        public CompanyNavigationViewModel GetCompany(SearchParams searchParams, int n)
        {
            var three = GetThreeCompanies(searchParams, n).ToList();

            if (three.Count == 0)
            {
                return(new CompanyNavigationViewModel
                {
                    Previous = null,
                    Current = null,
                    Next = null
                });
            }

            if (n == 1)
            {
                if (three.Count == 1)
                {
                    return(new CompanyNavigationViewModel
                    {
                        Previous = null,
                        Current = three[0].Id,
                        Next = null
                    });
                }

                return(new CompanyNavigationViewModel
                {
                    Previous = null,
                    Current = three[0].Id,
                    Next = three[1].Id
                });
            }
            else if (three.Count == 2)
            {
                return(new CompanyNavigationViewModel
                {
                    Previous = three[0].Id,
                    Current = three[1].Id,
                    Next = null
                });
            }
            else if (three.Count == 1)
            {
                return(new CompanyNavigationViewModel
                {
                    Previous = null,
                    Current = three[1].Id,
                    Next = null
                });
            }

            var res = new CompanyNavigationViewModel()
            {
                Previous = three[0].Id,
                Current  = three[1].Id,
                Next     = three[2].Id
            };

            return(res);
        }