Exemple #1
0
        public async Task <IActionResult> AddEvent(int id, int TripId)
        {
            // Callin SeatGeek API & and returning one specific event
            var response = await _seatGeekClient.GetEventByID(id);

            var eventChild = new SeatGeekChildDAL();
            var performer  = response.events[0].performers;
            var venue      = response.events[0].venue;

            //  Maping the event to seatGeekChild table
            //  then saving the SeatGeekChild data
            eventChild.ParentTripID  = TripId;
            eventChild.performerName = performer[0].name;
            eventChild.performerType = performer[0].type;
            eventChild.city          = venue.city;
            eventChild.id            = id;
            eventChild.ParentTripID  = TripId;
            eventChild.address       = venue.address;
            eventChild.name          = venue.name;


            _planFortDBContext.SeatGeekChild.Add(eventChild);
            _planFortDBContext.SaveChanges();
            return(RedirectToAction("ViewTrips", "Home"));
        }
Exemple #2
0
        public IActionResult DeleteEvent(int seatGeekChildId)
        {
            SeatGeekChildDAL eventDAL = _planFortDBContext.SeatGeekChild
                                        .Where(item => item.SeatGeekChildId == seatGeekChildId)
                                        .FirstOrDefault();

            _planFortDBContext.Remove(eventDAL);
            _planFortDBContext.SaveChanges();

            return(RedirectToAction("ViewTrips", "Home"));
        }
Exemple #3
0
        public async Task <IActionResult> AddEvent(int id, int TripId)
        {
            var response = await _seatGeekClient.GetEventByID(id);

            var eventChild = new SeatGeekChildDAL();
            var performer  = response.events[0].performers;
            var venue      = response.events[0].venue;


            eventChild.ParentTripID  = TripId;
            eventChild.performerName = performer[0].name;
            eventChild.performerType = performer[0].type;
            eventChild.city          = venue.city;
            eventChild.id            = id;
            eventChild.ParentTripID  = TripId;
            eventChild.address       = venue.address;
            eventChild.name          = venue.name;


            _planFortDBContext.SeatGeekChild.Add(eventChild);
            _planFortDBContext.SaveChanges();
            return(RedirectToAction("ViewTrips", "Home"));
        }