public bool DeleteAProductType(int id)
        {
            int index = productTypes.FindIndex(p => p.Id == id);

            if (index >= 0)
            {
                productTypes.RemoveAt(index);
                string rootPath = Path.Combine(webHostingEnvironment.WebRootPath, folder);
                LocalDataAccess.WriteDataProductType(rootPath, typeFile, productTypes);
                return(true);
            }
            return(false);
        }
        public bool AddAProductType(ProductType newProductType)
        {
            int index = productTypes.FindIndex(p => p.Id == newProductType.Id);

            if (index >= 0)
            {
                return(false);
            }
            productTypes.Add(newProductType);
            string rootPath = Path.Combine(webHostingEnvironment.WebRootPath, folder);

            LocalDataAccess.WriteDataProductType(rootPath, typeFile, productTypes);
            return(true);
        }
        public bool UpdateAProductType(int id, ProductType newProductType)
        {
            int index = productTypes.FindIndex(p => p.Id == id);

            if (index >= 0)
            {
                productTypes[index].Name      = newProductType.Name;
                productTypes[index].DateAdded = newProductType.DateAdded;
                productTypes[index].Status    = newProductType.Status;

                string rootPath = Path.Combine(webHostingEnvironment.WebRootPath, folder);
                LocalDataAccess.WriteDataProductType(rootPath, typeFile, productTypes);
                return(true);
            }
            return(false);
        }