Beispiel #1
0
        public async Task <T> Add <T>(T item) where T : class
        {
            var             querry = context.Set <T>();
            EntityEntry <T> output;

            try
            {
                output = await querry.AddAsync(item);
            }
            catch (Exception E)
            {
                throw new Exception("400",
                                    new Exception($"New item is invalid: {E.Message}"));
            }
            await context.SaveChangesAsync();

            return(output.Entity);
        }