public static ResponseViewModel <ProductSubCategory> AddProductSubCategory(ProductSubCategory productSubCategory)
        {
            ResponseViewModel <ProductSubCategory> responseViewModel = new ResponseViewModel <ProductSubCategory>();

            using (EcommerceEntities entities = new EcommerceEntities())
            {
                if (ProductSubCategoryManager.CheckDuplicate(productSubCategory))
                {
                    responseViewModel.errorViewModel            = new ErrorViewModel();
                    responseViewModel.errorViewModel.statusCode = 400;
                }
                else
                {
                    entities.ProductSubCategories.Add(productSubCategory);
                    responseViewModel.Data = productSubCategory;
                    entities.SaveChanges();
                }
            }
            return(responseViewModel);
        }
        public static ResponseViewModel <ProductSubCategory> UpdateProductSubCategory(ProductSubCategory productSubCategory)
        {
            ResponseViewModel <ProductSubCategory> responseViewModel = new ResponseViewModel <ProductSubCategory>();

            using (EcommerceEntities entities = new EcommerceEntities())
            {
                if (ProductSubCategoryManager.CheckDuplicate(productSubCategory))
                {
                    responseViewModel.errorViewModel            = new ErrorViewModel();
                    responseViewModel.errorViewModel.statusCode = 400;
                }
                else
                {
                    ProductSubCategory productSubCategoryDb = entities.ProductSubCategories.Where(entry => entry.ID == productSubCategory.ID).FirstOrDefault();
                    productSubCategoryDb.Name = productSubCategory.Name;
                    productSubCategoryDb.ProductCategoryID = productSubCategory.ProductCategoryID;
                    responseViewModel.Data = productSubCategoryDb;
                    entities.SaveChanges();
                }
            }
            return(responseViewModel);
        }