Esempio n. 1
0
        public async Task <Product> CreateAsync(Product entity)
        {
            var result = await context.Products.AddAsync(entity);

            await context.SaveChangesAsync();

            return(result.Entity);
        }
Esempio n. 2
0
        public async Task <Category> CreateAsync(Category entity)
        {
            try
            {
                var result = await context.Categories.AddAsync(entity);

                await context.SaveChangesAsync();

                return(result.Entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }