Пример #1
0
        public async Task <Guid> CreateAsync(EntityModels.Account account)
        {
            if (account is null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            account.Id = Guid.NewGuid();

            using (var connection = OpenConnection())
            {
                await connection.InsertAsync(account);

                return(account.Id);
            }
        }
Пример #2
0
        private ProjectionModels.Comment MapEntitiesIntoProjection(EntityModels.Comment comment, EntityModels.Account account)
        {
            var projection = mapper.Map <ProjectionModels.Comment>(comment);

            projection.Creator = mapper.Map <ProjectionModels.Account>(account);
            return(projection);
        }
Пример #3
0
        private ProjectionModels.Post MapEntitiesIntoProjection(EntityModels.Post post, EntityModels.Account account)
        {
            var projection = mapper.Map <ProjectionModels.Post>(post);

            projection.Creator = mapper.Map <ProjectionModels.Account>(account);
            return(projection);
        }
Пример #4
0
        public async Task <ProjectionModels.Account> CreateAsync(EntityModels.Account account)
        {
            var createdAccount = await accountRepository.CreateAsync(account);

            return(mapper.Map <ProjectionModels.Account>(createdAccount));
        }