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); }
public async Task <IEnumerable <T> > Get <T>() where T : class { return(await context.Set <T>().ToListAsync()); }