Beispiel #1
0
 public void UpdateProduct(Product product)
 {
     var oldProduct = GetProduct(product.Id);
     oldProduct.Name = product.Name;
     oldProduct.Description = product.Description;
     //oldProduct.IsCommon = product.IsCommon;
     oldProduct.ProductCategoryId = product.ProductCategoryId;
     productRepo.SaveChanges();
 }
Beispiel #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProducts(Product product)
 {
     base.AddObject("Products", product);
 }
Beispiel #3
0
 public static ProductModel FromDomainModel(Product product)
 {
     return new ProductModel {
         Id = product.Id,
         Name = product.Name,
         Description = product.Description,
         Category = product.ProductCategory.Name,
         IsCommon = product.IsCommon
     };
 }
Beispiel #4
0
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="productCategoryId">Initial value of the ProductCategoryId property.</param>
 /// <param name="objectInfo">Initial value of the ObjectInfo property.</param>
 /// <param name="isCommon">Initial value of the IsCommon property.</param>
 public static Product CreateProduct(global::System.Int32 id, global::System.String name, global::System.Int32 productCategoryId, ObjectInfo objectInfo, global::System.Boolean isCommon)
 {
     Product product = new Product();
     product.Id = id;
     product.Name = name;
     product.ProductCategoryId = productCategoryId;
     product.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo");
     product.IsCommon = isCommon;
     return product;
 }