Exemple #1
0
        public async Task CreateAsync(T entity)
        {
            var existing = await this.GetAsync(entity.Id);

            if (existing != null)
            {
                throw new InvalidOperationException(
                          string.Format("The {0} with user id {1} and id {2} already exists", typeof(T), entity.SaveItUserId, entity.Id));
            }

            db.GetEntitySet <T>().Add(entity);
        }