Exemplo n.º 1
0
        public async Task <bool> SaveStatus(EventInvite invite)
        {
            _context.Entry(invite).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(true);
        }
Exemplo n.º 2
0
        public async Task CreateEventAsync(Event @event, long userId)
        {
            @event.EventHost = new HostedEvent
            {
                UserId  = userId,
                EventId = @event.EventId
            };

            _context.Events.Add(@event);
            await _context.SaveChangesAsync();
        }
Exemplo n.º 3
0
        public async Task CreateAsync(Group group, long userId)
        {
            group.GroupUsers = new List <GroupUser>();
            group.GroupUsers.Add(new GroupUser {
                UserId = userId, Role = Role.owner
            });
            group.GroupRepeatedEvents = new List <GroupRepeatedEvent>();
            group.IsPublic            = false;

            switch (group.GroupSize)
            {
            case GroupSizes.free:
                group.MaxUsers  = 20;
                group.MaxEvents = 100;
                group.IsPublic  = true;
                break;

            case GroupSizes.extraSmall:
                group.MaxUsers  = 50;
                group.MaxEvents = 300;
                break;

            case GroupSizes.small:
                group.MaxUsers  = 100;
                group.MaxEvents = 500;
                break;

            case GroupSizes.medium:
                group.MaxUsers  = 250;
                group.MaxEvents = 1000;
                break;

            case GroupSizes.large:
                group.MaxUsers  = 1000;
                group.MaxEvents = 2500;
                break;

            case GroupSizes.infinite:
                group.MaxUsers  = -1;
                group.MaxEvents = -1;
                break;

            default:
                Console.WriteLine("Should not get here.");
                break;
            }

            _context.Groups.Add(@group);
            await _context.SaveChangesAsync();
        }