public ShoppingCartItem()
 {
     Date = DateTime.Now;
     Product = new Product() { };
     FreeQuantity = 0;
     TotalQuantity = 0;
     BoughtQuantity = 0;
     DiscountedQuantity = 0;
 }
 //
 // GET: /Product/Create
 public ActionResult Create()
 {
     Product product = new Product() { };
     IEnumerable<DiscountRuleEnum> enumTypeList = Enum.GetValues(typeof(DiscountRuleEnum)).Cast<DiscountRuleEnum>();
     product.DiscountRuleEnumTypeSelectList = from s in enumTypeList
                                         select new SelectListItem
                                         {
                                             Text = s.ToString(),
                                             Value = ((int)s).ToString()
                                         };
     return View(product);
 }
 public ActionResult Create(Product product)
 {
     try
     {
         if (ModelState.IsValid)
         {
             product.PricingRuleId = db.PricingRules.Where(p => p.DiscountRuleEnumType == product.DiscountRuleEnumType).FirstOrDefault().PricingRuleId;
             db.Products.Add(product);
             db.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }