public void Update(SubProductCategory updatedSubCategory) { var subCategory = _dbContext.SubCategories.FirstOrDefault(dbSubCat => dbSubCat.Id == updatedSubCategory.Id); if (subCategory != null) { subCategory.Id = updatedSubCategory.Id; subCategory.Title = updatedSubCategory.Title; subCategory.Category = updatedSubCategory.Category; _dbContext.SaveChanges(); } }
public void Add(SubProductCategory newSubCategory) { _dbContext.SubCategories.Add(newSubCategory); _dbContext.SaveChanges(); }