Exemplo n.º 1
0
 public void AddArchiveRecordToDb(EntityProducts.Product product)
 {
     _dbContext.Products.Update(product)
     .Entity
     .IsArchived = true;
     _dbContext.SaveChanges();
 }
Exemplo n.º 2
0
        // in goes an entity model and out comes a service model
        public static ServiceProducts.Product SerialiseProduct(EntityProducts.Product entityProduct)
        {
            var serviceProduct = new ServiceProducts.Product()
            {
                Id          = entityProduct.Id,
                Name        = entityProduct.Name,
                Description = entityProduct.Description,
                Category    = entityProduct.Category,
                Price       = entityProduct.Price,
                IsOnSale    = entityProduct.IsOnSale,
                IsArchived  = entityProduct.IsArchived,
                IsTaxable   = entityProduct.IsTaxable,
                CreatedOn   = entityProduct.CreatedOn,
                UpdatedOn   = entityProduct.UpdatedOn
            };

            return(serviceProduct);
        }
Exemplo n.º 3
0
 public void DeleteProductFromDb(EntityProducts.Product productToDelete)
 {
     _dbContext.Products.Remove(productToDelete);
     _dbContext.SaveChanges();
 }
Exemplo n.º 4
0
 public void AddProductToDb(EntityProducts.Product productToAdd)
 {
     _dbContext.Products.Add(productToAdd);
     _dbContext.SaveChanges();
 }