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)); }
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()); }
public async Task <IActionResult> VenueList() { var response = await _eventiApi.GetVenueAsync(); var model = response.Content.Data .Select ( i => new VenueVM { ID = i.ID, Name = i.Name, Address = i.Address, VenueCategory = i.VenueCategory, CityID = i.CityID } ) .ToList(); return(View(model)); }