Ejemplo n.º 1
0
        public async Task <IActionResult> FindFriends()
        {
            var l = await _profileRepository.GetObjectsList();

            //ProfileViewModel allProfiles = new ProfileViewModel();
            //allProfiles = await _profileRepository.GetObjectsList();

            return(View(new ProfileViewModelsList(l)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(string sortOrder    = null,
                                                string searchString = null, int?page = null, string currentFilter = null)
        {
            ViewData["userRealName"] = await _profileRepository.GetObjectsList();

            ViewData["SortName"]       = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewData["SortID"]         = sortOrder == "id" ? "id_desc" : "id";
            ViewData["SortDate"]       = sortOrder == "date" ? "date_desc" : "date";
            ViewData["SortLocation"]   = sortOrder == "location" ? "location_desc" : "location";
            ViewData["SortOrganizer"]  = sortOrder == "organizer" ? "organizer_desc" : "organizer";
            _eventRepository.SortOrder = sortOrder != null && sortOrder.EndsWith("_desc")
                ? SortOrder.Descending
                : SortOrder.Ascending;
            _eventRepository.SortFunction = getSortFunction(sortOrder);
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewData["CurrentFilter"]     = searchString;
            _eventRepository.SearchString = searchString;
            _eventRepository.PageIndex    = page ?? 1;

            AllEventsViewModel allevents = new AllEventsViewModel();

            allevents.AllEventViewModel = await _eventRepository.GetObjectsList();

            allevents.MyEventsViewModel = await _attendingRepository.GetUserEventsList(GetCurrentUserID());

            allevents.MyOrganizedEventsViewModel = await _eventRepository.GetOrganizerEventsList(GetCurrentUserID());

            return(View(allevents));
        }