Пример #1
0
        public async Task <IActionResult> SearchByLocation(string lokacija)
        {
            // To do: Implement event search by venue name
            EventSearchVM model = new EventSearchVM();

            if (lokacija != null)
            {
                var response = await _eventiApi.GetEventAsync(new EventSearchRequest()
                {
                    Name       = lokacija,
                    IsApproved = true,
                    IsCanceled = true,
                    Start      = DateTime.Now
                });

                model.Events = response.Content.Data
                               .Select
                               (
                    i => new EventSearchVM.Rows()
                {
                    EventID  = i.ID,
                    Name     = i.Name,
                    Category = i.EventCategory.ToString(),
                    Start    = i.Start,
                    End      = i.End,
                    Image    = i.Image
                }
                               ).ToList();
            }

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> Index(string filter)
        {
            EventSearchVM model = new EventSearchVM();

            var user = await HttpContext.GetLoggedInUser();

            if (user != null)
            {
                model.ClientID = user.ID;
            }

            if (filter == "Music")
            {
                model.Events = await SearchByCategory(EventCategory.Music);
            }
            else if (filter == "Sport")
            {
                model.Events = await SearchByCategory(EventCategory.Sport);
            }
            else if (filter == "Coulture")
            {
                model.Events = await SearchByCategory(EventCategory.Coulture);
            }
            else if (filter != null)
            {
                model.Events = await SearchByNameAndLocation(filter);
            }
            else
            {
                model.Events = await GetEvents();
            }

            return(View(model));
        }
Пример #3
0
        public async Task <IActionResult> SearchByName(string filter)
        {
            EventSearchVM model = new EventSearchVM();

            if (filter != null)
            {
                var response = await _eventiApi.GetEventAsync(new EventSearchRequest()
                {
                    Name       = filter,
                    IsApproved = true,
                    IsCanceled = true,
                    Start      = DateTime.Now
                });

                model.Events = response.Content.Data
                               .Select
                               (
                    i => new EventSearchVM.Rows()
                {
                    EventID  = i.ID,
                    Name     = i.Name,
                    Category = i.EventCategory.ToString(),
                    Start    = i.Start,
                    End      = i.End,
                    Image    = i.Image
                }
                               ).ToList();
            }

            return(View(model));
        }