public void Delete(int id, ProductPricing productPricing)
        {
            ProductPricing entityToEdit = (from cust in _dataContext.ProductPricings
                                           where cust.Id == id
                                           select cust).FirstOrDefault();

            _dataContext.DeleteObject(entityToEdit);
            _dataContext.SaveChanges();
        }
        public void Edit(int id, ProductPricing productPricing)
        {
            ProductPricing entityToEdit = (from cust in _dataContext.ProductPricings
                                           where cust.Id == id
                                           select cust).FirstOrDefault();

            entityToEdit.ProductId = productPricing.ProductId;
            entityToEdit.IsOnSale = productPricing.IsOnSale;
            entityToEdit.Price = productPricing.Price;
            entityToEdit.ModifiedDate = DateTime.Now;

            _dataContext.SaveChanges();
        }
        public void Add(int productId, ProductPricing productPricing)
        {
            var addr = new ProductPricing
                           {
                               ProductId = productId,
                               Price = productPricing.Price,
                               IsOnSale = productPricing.IsOnSale,
                               ModifiedDate = DateTime.Now
                           };

            _dataContext.ProductPricings.AddObject(addr);
            _dataContext.SaveChanges();
        }
 public ActionResult Create(int productId, ProductPricing productPricing)
 {
     try
     {
         _repository.Add(productId, productPricing);
         var productPricingViewModel = new ProductPricingViewModel
         {
             Id = productPricing.Id,
             ProductId = productPricing.ProductId,
             Price = productPricing.Price,
             IsOnSale = productPricing.IsOnSale,
             ModifiedDate = productPricing.ModifiedDate
         };
         return RedirectToAction("Index", productPricingViewModel);
     }
     catch
     {
         return View();
     }
 }
        public ActionResult Delete(int Id, ProductPricing productPricing)
        {
            try
            {
                ProductPricing productPricingToDelete = _repository.Get(Id);
                _repository.Delete(Id, productPricingToDelete);

                var productPricingViewModel = new ProductPricingViewModel
                {
                    Id = productPricing.Id,
                    ProductId = productPricing.ProductId,
                    Price = productPricing.Price,
                    IsOnSale = productPricing.IsOnSale,
                    ModifiedDate = productPricing.ModifiedDate
                };
                return RedirectToAction("Index", productPricingViewModel);
            }
            catch
            {
                return View();
            }
        }
 public void Edit(int id, ProductPricing productPricing)
 {
     _productPricingRepository.Edit(id, productPricing);
 }
 public void Delete(int Id, ProductPricing productPricing)
 {
     _productPricingRepository.Delete(Id, productPricing);
 }
 public void Add(int id, ProductPricing productPricing)
 {
     _productPricingRepository.Add(id, productPricing);
 }
示例#9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductPricings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductPricings(ProductPricing productPricing)
 {
     base.AddObject("ProductPricings", productPricing);
 }
示例#10
0
 /// <summary>
 /// Create a new ProductPricing object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 /// <param name="isOnSale">Initial value of the IsOnSale property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static ProductPricing CreateProductPricing(global::System.Int32 id, global::System.Int32 productId, global::System.Decimal price, global::System.Boolean isOnSale, global::System.DateTime modifiedDate)
 {
     ProductPricing productPricing = new ProductPricing();
     productPricing.Id = id;
     productPricing.ProductId = productId;
     productPricing.Price = price;
     productPricing.IsOnSale = isOnSale;
     productPricing.ModifiedDate = modifiedDate;
     return productPricing;
 }