public virtual async Task <TEntity> AddAsync(TEntity entity)
        {
            await _dbContext.AddAsync(entity);

            await _dbContext.SaveChangesAsync();

            return(entity);
        }
示例#2
0
        public async Task <Employees> InsertEmployeesAsync(Employees employee)
        {
            await _context.AddAsync(employee);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception exp)
            {
                _Logger.LogError($"Error in {nameof(InsertEmployeesAsync)}: " + exp.Message);
            }
            return(employee);
        }
示例#3
0
        public async Task <Orders> InsertOrdersAsync(Orders order)
        {
            await _context.AddAsync(order);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception exp)
            {
                _Logger.LogError($"Error in {nameof(InsertOrdersAsync)}: " + exp.Message);
            }
            return(order);
        }
        public async Task <Product> CreateProductAsync(Product product)
        {
            await _dbContext.AddAsync(product);

            return(product);
        }