public ActionResult Create(ProductAttribute model)
        {
            try
            {
                using (var context = new ShopContainer())
                {
                    if (string.IsNullOrEmpty(model.ValueType))
                        model.ValueType = string.Empty;
                    context.AddToProductAttribute(model);
                    context.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductAttribute EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductAttribute(ProductAttribute productAttribute)
 {
     base.AddObject("ProductAttribute", productAttribute);
 }
Example #3
0
 /// <summary>
 /// Create a new ProductAttribute object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="valueType">Initial value of the ValueType property.</param>
 /// <param name="showInCommonView">Initial value of the ShowInCommonView property.</param>
 public static ProductAttribute CreateProductAttribute(global::System.Int32 id, global::System.String name, global::System.String valueType, global::System.Boolean showInCommonView)
 {
     ProductAttribute productAttribute = new ProductAttribute();
     productAttribute.Id = id;
     productAttribute.Name = name;
     productAttribute.ValueType = valueType;
     productAttribute.ShowInCommonView = showInCommonView;
     return productAttribute;
 }