Ejemplo n.º 1
0
        public bool RemoveUserAsHost(UserAccount user, Event e)
        {
            EventPermissionModifier modifier = context.EventPermissionModifiers
                                               .FirstOrDefault(m => m.Event.ID == e.ID && m.User.ID == user.ID);

            if (modifier != null)
            {
                context.EventPermissionModifiers.Remove(modifier);
                context.SaveChanges();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Registers the given user as an event host.
        /// </summary>
        public bool RegisterUserAsHost(UserAccount user, Event e)
        {
            EventPermissionModifier modifier = new EventPermissionModifier
            {
                Event       = e,
                User        = user,
                Permissions = EventPermissions.Host
            };

            context.EventPermissionModifiers.Add(modifier);

            return(context.SaveChanges() > 0);
        }