Ejemplo n.º 1
0
        public async Task <int> Add(T entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            await entities.AddAsync(entity);

            await context.SaveChangesAsync();

            var IdProperty = entity.GetType().GetProperty("Id").GetValue(entity, null);

            return((int)IdProperty);
        }