public void UpdateCategory(ProductCategory category) { var oldCategory = GetProductCategory(category.Id); oldCategory.Name = category.Name; oldCategory.Description = category.Description; categoryRepo.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the ProductCategories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProductCategories(ProductCategory productCategory) { base.AddObject("ProductCategories", productCategory); }
public static ProductCategoryModel FromDomainModel(ProductCategory category) { return new ProductCategoryModel { Id = category.Id, Name = category.Name, Description = category.Description }; }
/// <summary> /// Create a new ProductCategory object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="objectInfo">Initial value of the ObjectInfo property.</param> public static ProductCategory CreateProductCategory(global::System.Int32 id, global::System.String name, ObjectInfo objectInfo) { ProductCategory productCategory = new ProductCategory(); productCategory.Id = id; productCategory.Name = name; productCategory.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo"); return productCategory; }