public async Task <EmployeeResource> AddAsync(EmployeeResource resource)
        {
            Employee entity = ToEntity(resource);

            _db.Employees.Add(entity);
            await _db.SaveChangesAsync();

            return(ToResource(entity));
        }
        public async Task <CategoryResource> AddAsync(CategoryResource resource)
        {
            Category entity = ToEntity(resource);

            _db.Categories.Add(entity);
            await _db.SaveChangesAsync();

            return(ToResource(entity));
        }
Exemplo n.º 3
0
        public async Task <CustomerResource> AddAsync(CustomerResource resource)
        {
            Customer entity = ToEntity(resource);

            _db.Customers.Add(entity);
            await _db.SaveChangesAsync();

            return(ToResource(entity));
        }
        public async Task <ProductResource> AddAsync(ProductResource resource)
        {
            Product entity = ToEntity(resource);

            _db.Products.Add(entity);
            await _db.SaveChangesAsync();

            return(ToResource(entity));
        }
        public virtual async Task <TEntity> Add(TEntity entity)
        {
            DbSet.Add(entity);
            await Db.SaveChangesAsync();

            return(entity);
        }