示例#1
0
        /// <summary>
        /// Removes an user from a specific event
        /// </summary>
        /// <param name="user"></param>
        /// <param name="eEvent"></param>
        ///
        public void RemoveUserFromEvent(MFUser user, Event eEvent)
        {
            Attending attending = context.Attendings.Where(r => (r.UserId == user.UserId) && (r.EventId == eEvent.EventId)).FirstOrDefault();

            if (attending != null)
            {
                context.Attendings.Remove(attending);
            }
        }
示例#2
0
        /// <summary>
        /// Adds user as participating in the event
        /// </summary>
        /// <param name="user"></param>
        /// <param name="newEvent"></param>
        ///
        public void AddUserToEvent(MFUser user, Event newEvent, AttendingEnum isAttending)
        {
            Attending attending = context.Attendings.Where(r => (r.UserId == user.UserId) && (r.EventId == newEvent.EventId)).FirstOrDefault();

            if (attending == null)
            {
                attending = new Attending()
                {
                    UserId     = user.UserId,
                    EventId    = newEvent.EventId,
                    Attending1 = (int)isAttending
                };
                context.Attendings.Add(attending);
            }
            attending.Attending1 = (int)isAttending;
        }