Ejemplo n.º 1
0
        private void AddUsersToPositions(Event dbEvent)
        {
            if (dbEvent.Positions.Count == 0)
            {
                foreach (var position in dbEvent.Sport.Positions)
                {
                    var newPos = new EventAttendeesToBeApproved();
                    newPos.Position      = new Position();
                    newPos.PositionId    = position.Id;
                    newPos.Position.Id   = position.Id;
                    newPos.Position.Name = position.Name;
                    dbEvent.Positions.Add(newPos);
                }
            }
            var atendees = attendanceService.GetAllEventAttendeesForEvent(dbEvent.Id).ToList();

            foreach (var atendee in atendees)
            {
                var position = dbEvent.Positions.First(p => p.PositionId == atendee.PositionId);
                position.Position.EventAttendees.Add(atendee);
            }
            var atendeesForAprooving = attendanceService.GetAllEventAttendeesToBeApprovedForEvent(dbEvent.Id).ToList();

            foreach (var atendee in atendeesForAprooving)
            {
                var position = dbEvent.Positions.First(p => p.PositionId == atendee.PositionId);
                position.Position.EventAttendeesToBeApproved.Add(atendee);
            }
        }
Ejemplo n.º 2
0
        public IActionResult JoinUser(IDictionary <string, string> rv)
        {
            int    eventId    = int.Parse(rv["eventId"]);
            int    positionId = int.Parse(rv["positionId"]);
            string joinID     = this.userManager.GetUserId(User);

            if (!attendanceService.GetAllEventAttendeesForEvent(eventId).Any(a => a.UserId == joinID))
            {
                attendanceService.RegisterUserForEvent(joinID, eventId, positionId).Wait();
            }

            return(RedirectToAction("HomePageView", "HomePage"));
        }
Ejemplo n.º 3
0
        public IActionResult JoinUser(JoinUserModel model)
        {
            int    eventId    = model.EventId;
            int    positionId = model.PositionId;
            string joinId     = this.userManager.GetUserId(User);

            if (!attendanceService.GetAllEventAttendeesForEvent(eventId).Any(a => a.UserId == joinId))
            {
                attendanceService.RegisterUserForEvent(joinId, eventId, positionId).Wait();
            }

            return(RedirectToAction("DetermineEventView", "HomePage", new { Id = eventId }));
        }