Ejemplo n.º 1
0
        public ActionResult InterestsMozaic(int id, long filterCode)
        {
            var interests            = this.searchService.GetMemberInterests(id, filterCode, count: 40).ToList();
            InterestsViewModel model = new InterestsViewModel(interests);

            return(this.Json(model.Object, JsonRequestBehavior.AllowGet));
        }
        private string GetInterests(int projectId, long[] usersList, int interestCount)
        {
            var interests            = this.metricsService.GetMemberInterests(projectId, usersList, interestCount).ToList();
            InterestsViewModel model = new InterestsViewModel(interests);

            return(model.Interests);
        }
Ejemplo n.º 3
0
        public IActionResult Interests()
        {
            var interestsForUser = _interestsService.GetAllInterestsForUser("user2");
            var model            = new InterestsViewModel();

            model.Interests = interestsForUser.Result;
            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult DeleteInterest()
        {
            try
            {
                var MyId      = ThisUser();
                var ctx       = new Gr8DbContext();
                var viewModel = new InterestsViewModel()
                {
                    InterestsList = ctx.Database.SqlQuery <Interests>("Select * from Interests Where Id in(Select Interest From UserInterests Where UserId=" + MyId + ")").ToList()
                };

                return(View(viewModel));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(View("Error"));
            }
        }
Ejemplo n.º 5
0
        public ActionResult AddInterests()
        {
            try
            {
                var ctx       = new Gr8DbContext();
                var viewModel = new InterestsViewModel()
                {
                    Interest      = new Interests(),
                    InterestsList = ctx.Database.SqlQuery <Interests>("Select * from Interests").ToList()
                };

                return(View(viewModel));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(View("Error"));
            }
        }
Ejemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var na   = Locator.Current.GetService <INetworkActivityService>();
            var a    = Locator.Current.GetService <IApplicationService>();
            var feat = Locator.Current.GetService <IFeaturesService>();

            var profileViewModel      = new ProfileViewModel(a, na, feat);
            var profileViewController = new ProfileViewController {
                ViewModel = profileViewModel
            };

            profileViewController.ViewModel.GoToInterestsCommand.Subscribe(_ => SelectedIndex = 1);
            profileViewController.TabBarItem     = new UITabBarItem("Profile", Images.User, Images.UserFilled);
            profileViewController.ViewModel.View = profileViewController;

            var interestsViewModel      = new InterestsViewModel(a, feat);
            var interestsViewController = new InterestsViewController {
                ViewModel = interestsViewModel
            };

            interestsViewController.TabBarItem     = new UITabBarItem("Interests", Images.Heart, Images.HeartFilled);
            interestsViewController.ViewModel.View = interestsViewController;

            var trendingViewModel      = new TrendingViewModel(na, new RepositoryStumble.Core.Data.TrendingRepository());
            var trendingViewController = new TrendingViewController();

            trendingViewController.ViewModel      = trendingViewModel;
            trendingViewController.TabBarItem     = new UITabBarItem("Trending", Images.Trending, Images.TrendingFilled);
            trendingViewController.ViewModel.View = trendingViewController;

            var vm = new ShowcasesViewModel(Locator.Current.GetService <INetworkActivityService>(), new RepositoryStumble.Core.Data.ShowcaseRepository());
            var showcasesViewController = new ShowcasesViewController {
                ViewModel = vm
            };

            showcasesViewController.TabBarItem     = new UITabBarItem("Showcase", Images.Spotlight, Images.Spotlight);
            showcasesViewController.ViewModel.View = showcasesViewController;

            var stumble = new UIViewController();

            stumble.TabBarItem = new UITabBarItem("Stumble!", Images.Search, Images.Search);

            this.ViewControllers = new[]
            {
                new UINavigationController(profileViewController),
                new UINavigationController(interestsViewController),
                stumble,
                new UINavigationController(trendingViewController),
                new UINavigationController(showcasesViewController)
            };

            nfloat width = 60;

            if (TabBar.Subviews.Length == 5)
            {
                width = TabBar.Subviews[2].Bounds.Width;
            }

            var stumbleView = new StumbleView(new CGRect(TabBar.Bounds.Width / 2f - width / 2, 0, width, TabBar.Bounds.Height), UITabBar.Appearance.TintColor);

            stumbleView.AutoresizingMask       = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            stumbleView.UserInteractionEnabled = false;
            TabBar.Add(stumbleView);

            nint previousSelectedIndex = 0;

            ViewControllerSelected += (sender, e) =>
            {
                if (e.ViewController == stumble)
                {
                    if (Locator.Current.GetService <IApplicationService>().Account.Interests.Count() == 0)
                    {
                        SelectedIndex = 1;
                        Locator.Current.GetService <IAlertDialogService>().Alert(
                            "You need some interests!",
                            "Please add at least one interest before you stumble!");
                    }
                    else
                    {
                        ViewModel.GoToStumbleCommand.ExecuteIfCan();
                        SelectedIndex = previousSelectedIndex;
                    }
                }
                else
                {
                    previousSelectedIndex = SelectedIndex;
                }
            };
        }
Ejemplo n.º 7
0
        public string GetUserInterestsTags(int id)
        {
            InterestsViewModel model = new InterestsViewModel(this.metricsService.GetMemberInterests(id, null, 40).ToList());

            return(model.Interests);
        }