public async Task <MessageModelView> Create(MessageModelView modelView, IEntityBuilder <Message, MessageModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            var message = await builder.Create(modelView);

            await _context.Messages.AddAsync(message);

            await _context.SaveChangesAsync();

            return(await Get(message.Id, builder));
        }
        public async Task <GroupModelView> Create(GroupModelView modelView, IEntityBuilder <Group, GroupModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            var group = await builder.Create(modelView);

            await _context.Groups.AddAsync(group);

            await _context.SaveChangesAsync();

            modelView.Id = group.Id;

            return(modelView);
        }
Esempio n. 3
0
        public async Task <UserModelView> Create(UserModelView modelView, IEntityBuilder <User, UserModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            var user = await builder.Create(modelView);

            if (user == null)
            {
                return(null);
            }

            await _context.Users.AddAsync(user);

            await _context.SaveChangesAsync();

            return(modelView);
        }
        public async Task <InviteModelView> Create(InviteModelView modelView, IEntityBuilder <Invite, InviteModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            var invite = await builder.Create(modelView);

            if (invite == null)
            {
                return(null);
            }

            await _context.Invites.AddAsync(invite);

            await _context.SaveChangesAsync();

            modelView.Id = invite.Id;

            return(modelView);
        }