Ejemplo n.º 1
0
 private SpaceReadView Map(SpaceRecord source) => new SpaceReadView()
 {
     Id              = source.Id,
     Name            = source.Name,
     Description     = source.Description,
     CreationDate    = source.CreationDate,
     SubscriberCount = source.SubscriptionCount,
     IsDefault       = source.IsDefault
 };
Ejemplo n.º 2
0
        /// <summary>
        /// Add a new space to the database.
        /// </summary>
        /// <param name="entity">The space to add.</param>
        public async Task Add(Space entity)
        {
            SpaceRecord rec = mapper.Reverse(entity).Item1;

            entity.Id = await Connection.QueryFirstOrDefaultAsync <int>(
                @"INSERT INTO Space(
                        Name,
                        Description,
                        CreationDate,
                        SubscriptionCount,
                        UserId,
                        IsDefault
                        ) VALUES (
                        @Name,
                        @Description,
                        @CreationDate,
                        @SubscriptionCount,
                        @UserId,
                        @IsDefault
                        ) RETURNING Id;", rec
                );
        }
Ejemplo n.º 3
0
 private Space Map(SpaceRecord rec) => factory.Create(rec.Id, rec.UserId, rec.Name, rec.Description, rec.CreationDate, rec.SubscriptionCount, rec.IsDefault);