Beispiel #1
0
        /// <summary>
        /// Gets all event users for a given group in a given event
        /// </summary>
        /// <returns>event users</returns>
        public CameleoEventUserListViewModel GetEventUserListViewModel(int pEventId, string pGroup)
        {
            var tmpEventUserCount         = GetEventUsersCount(pEventId, pGroup);
            var tmpAcceptedEventUserCount = GetAcceptedEventUsersCount(pEventId, pGroup);
            var records = GetAllEventUsers(pEventId, pGroup);
            CameleoEventUserListViewModel eventUserListViewModel = new CameleoEventUserListViewModel();
            var eventUsers = records
                             .Select(x =>
            {
                var m = new CameleoEventUserViewModel()
                {
                    Id                     = x.Id,
                    EventId                = x.EventId,
                    UserName               = x.UserName,
                    Password               = x.Password,
                    LastName               = x.LastName,
                    FirstName              = x.FirstName,
                    Email                  = x.Email,
                    UniqueId               = x.UniqueId,
                    Group                  = x.Group,
                    SuperiorName           = x.SuperiorName,
                    isStaff                = x.isStaff,
                    CreatedOnUtc           = x.CreatedOnUtc,
                    EventUserCount         = tmpEventUserCount,
                    AcceptedEventUserCount = tmpAcceptedEventUserCount,
                };
                return(m);
            })
                             .ToList();

            eventUserListViewModel.CameleoEventUserList = eventUsers;
            return(eventUserListViewModel);
        }
Beispiel #2
0
        public ActionResult EventUserUpdate(CameleoEventUserViewModel model)
        {
            var tmpEventUser = _eventUserService.GetEventUserById(model.Id);

            if (tmpEventUser == null)
            {
                //Event user not found
                throw new ArgumentException(_localizationService.GetResource("Plugins.Cameleo.CameleoEventUsers.Update.NotFound"));
            }

            //Update event user
            tmpEventUser.Password     = model.Password;
            tmpEventUser.LastName     = model.LastNameFull;
            tmpEventUser.FirstName    = model.FirstName;
            tmpEventUser.Email        = model.Email;
            tmpEventUser.UniqueId     = model.UniqueId;
            tmpEventUser.Group        = model.Group;
            tmpEventUser.SuperiorName = model.SuperiorName;
            tmpEventUser.isStaff      = model.isStaff;
            _eventUserService.UpdateEventUser(tmpEventUser);

            // Refresh view
            return(new NullJsonResult());
        }