Example #1
0
        public async Task <IActionResult> EventEdit(int ID)
        {
            var response = await _eventiApi.GetEventAsync(ID);

            var entity = response.Content;
            var model  = new EventVM()
            {
                ID              = entity.ID,
                Name            = entity.Name,
                Description     = entity.Description,
                Start           = entity.Start,
                End             = entity.End,
                EventCategory   = entity.EventCategory,
                Image           = entity.Image,
                IsApproved      = entity.IsApproved,
                IsCanceled      = entity.IsCanceled,
                OrganizerID     = entity.OrganizerID,
                AdministratorID = entity.AdministratorID,
                VenueID         = entity.VenueID
            };

            model.Organizers = (await _eventiApi.GetOrganizerAsync()).Content.Data.Select(
                d => new SelectListItem(d.Name, d.ID.ToString())).ToList();
            model.Administrators = (await _eventiApi.GetAdministratorAsync()).Content.Data.Select(
                d => new SelectListItem(d.FirstName + " " + d.LastName, d.ID.ToString())).ToList();
            model.Venues = (await _eventiApi.GetVenueAsync()).Content.Data.Select(
                d => new SelectListItem(d.Name, d.ID.ToString())).ToList();

            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> Index()
        {
            var account = await HttpContext.GetLoggedInUser();

            var response = await _eventiApi.GetOrganizerAsync(new OrganizerSearchRequest()
            {
                AccountID = account.ID
            });

            var organizer = response.Content.Data.ToList()[0];

            List <EventVM> events = await GetEvents(organizer.ID);

            var venueResponse = await _eventiApi.GetVenueAsync();

            ViewData["OrganizatorID"]      = organizer.ID;
            ViewData["EventiOrganizatora"] = events;
            ViewData["ProstoriOdrzavanja"] = venueResponse.Content.Data.Select(s => new SelectListItem
            {
                Value = s.ID.ToString(),
                Text  = s.Name
            }).ToList();

            return(View());
        }
Example #3
0
        public async Task <IActionResult> OrganizerList()
        {
            var response = await _eventiApi.GetOrganizerAsync();

            var model = response.Content.Data
                        .Select
                        (
                i => new OrganizerVM
            {
                ID          = i.ID,
                AccountID   = i.AccountID,
                Name        = i.Name,
                PhoneNumber = i.PhoneNumber,
                CityID      = i.CityID,
                Username    = i.Username,
                Email       = i.Email
            }
                        )
                        .ToList();

            return(View(model));
        }
Example #4
0
        private async Task <IActionResult> HandleOrganizerLogin(int accountID)
        {
            var response = await _eventiApi.GetOrganizerAsync(new OrganizerSearchRequest()
            {
                AccountID = accountID
            });

            var organizer = response.Content.Data.ToList()[0];

            var account = _mapper.Map <Account>(organizer);

            HttpContext.SetLoggedInUser(account);

            return(Redirect("/Organizer/OrganizatorHome/Index"));
        }