예제 #1
0
        public ActionResult Index()
        {
            if (CurrentSession.User == null)
            {
                return(RedirectToAction("Login", "Users"));
            }
            ActivityJoin acJoin = managementActivityJoin.Find(x => x.UserID == CurrentSession.User.Id);



            List <Activity>     activities    = new List <Activity>();
            List <ActivityJoin> activityJoins = new List <ActivityJoin>();

            foreach (ActivityJoin hes in managementActivityJoin.List())
            {
                if (hes.UserID == CurrentSession.User.Id)
                {
                    activityJoins.Add(hes);

                    foreach (Activity hess in managementActivity.List())
                    {
                        if (hess.Id == hes.ActivityID)
                        {
                            activities.Add(hess);
                        }
                    }
                }
            }



            return(View(activities));
        }
예제 #2
0
        public ActionResult ActivityList(EventListViewModel eventListViewModel)
        {
            if (CurrentSession.User == null)
            {
                return(RedirectToAction("Login", "Users"));
            }


            double          range     = eventListViewModel.RangeID / 100;
            double          Latitude  = Convert.ToDouble(eventListViewModel.Latitude.Replace('.', ','));
            double          Longitude = Convert.ToDouble(eventListViewModel.Longitude.Replace('.', ','));
            DatabaseContext db        = new DatabaseContext();

            ActivityJoin acJoin = managementActivityJoin.Find(x => x.UserID == CurrentSession.User.Id);


            List <Activity>     activities    = new List <Activity>();
            List <ActivityJoin> activityJoins = new List <ActivityJoin>();

            foreach (Activity hess in managementActivity.List())
            {
                if (hess.UserID != CurrentSession.User.Id)
                {
                    if ((Convert.ToDouble(hess.Latitude) > Latitude - range && Convert.ToDouble(hess.Latitude) < Latitude + range) &&
                        (Convert.ToDouble(hess.Longitude) > Longitude - range && Convert.ToDouble(hess.Longitude) < Longitude + range) &&
                        hess.CategoryID == eventListViewModel.CategoryID)
                    {
                        foreach (ActivityJoin hes in managementActivityJoin.List())
                        {
                            if (hes.ActivityID != hess.Id)
                            {
                                activities.Add(hess);
                            }
                        }
                    }
                }
            }


            return(View(activities));
        }