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);
        }
Exemple #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);
        }
Exemple #5
0
        public async Task <UserModelView> Get(object Id, IEntityBuilder <User, UserModelView> builder)
        {
            builder.ConfigureBuilder(_context, _environment);

            return(await builder.GetModelView(Id));
        }
        public async Task <MessageModelView> Get(object id, IEntityBuilder <Message, MessageModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            return(await builder.GetModelView(id));
        }
        public async Task <InviteModelView> Get(object Id, IEntityBuilder <Invite, InviteModelView> builder)
        {
            builder.ConfigureBuilder(_context);

            return(await builder.GetModelView(Id));
        }