Esempio n. 1
0
	public ProductFamilly(ProductType type, string famillyName, string image)
        {
            Type = type;
            FamillyName = famillyName;
	    Image = image;
        }
Esempio n. 2
0
 public ProductFamilly(ProductType type, string famillyName)
 {
     Type = type;
     FamillyName = famillyName;
 }
Esempio n. 3
0
 private ProductType CreateProductType(ApplicationDbContext context, string name,string imageName = null)
 {
     ProductType type = context.ProductTypes.FirstOrDefault(x=> x.Name == name);
     if (type == null)
     {
         type = new ProductType(name);
         context.ProductTypes.Add(type);
         if(imageName != null)
         {
             type.Image = Path.Combine(Configurations.ProductsTypeAndFamillyIconsStockagesPath, imageName);
         }
     }
     return type;
 }
Esempio n. 4
0
        private ProductFamilly CreateProductFamily(ApplicationDbContext context, ProductType type, string name, string imageName = null)
        {
            ProductFamilly family = context.ProductFamillys.FirstOrDefault(x=> x.FamillyName == name);
            if (family == null)
            {
                family = new ProductFamilly(type, name);
		if(imageName != null)
                {
                    family.Image = Path.Combine(Configurations.ProductsTypeAndFamillyIconsStockagesPath, imageName);
                }
                context.ProductFamillys.Add(family);
            }
            return family;
        }
 public IActionResult CreateCategory(string categoryName)
 {
     var productCategory = new ProductType(categoryName);
     _context.ProductTypes.Add(productCategory);
     _context.SaveChanges();
     return Ok();
 }