コード例 #1
0
        public void CreateOrUpdatePriceForSize(Product_PriceForSize ps)
        {
            var p = _productRepository.Table.SingleOrDefault(_p => _p.ProductId == ps.ProductId);

            if (p != null)
            {
                p.HasPriceForSize = ps.HasPriceForSize;

                p.StandardPriceType  = ps.StandardPriceType;
                p.MeasureDimensionId = ps.MeasureDimensionId;

                p.WidthAttributeId       = ps.WidthAttributeId;
                p.MinimumWidthManageable = ps.MinimumWidthManageable;
                p.MaximumWidthManageable = ps.MaximumWidthManageable;

                p.HeightAttributeId       = ps.HeightAttributeId;
                p.MinimumHeightManageable = ps.MinimumHeightManageable;
                p.MaximumHeightManageable = ps.MaximumHeightManageable;

                p.DepthAttributeId       = ps.DepthAttributeId;
                p.MinimumDepthManageable = ps.MinimumDepthManageable;
                p.MaximumDepthManageable = ps.MaximumDepthManageable;

                p.MinimumBillablePerimeter = ps.MinimumBillablePerimeter;
                p.MinimumBillableArea      = ps.MinimumBillableArea;
                p.MinimumBillableVolume    = ps.MinimumBillableVolume;

                _productRepository.Update(p);
            }
            else
            {
                _productRepository.Insert(ps);
            }
        }
    public void CreateOrUpdatePriceForSize(Product_PriceForSize ps)
    {
      var p = _productRepository.Table.SingleOrDefault(_p => _p.ProductId == ps.ProductId);
      if (p != null)
      {
        p.HasPriceForSize = ps.HasPriceForSize;

        p.WidthAttributeId = ps.WidthAttributeId;
        p.MinimumWidthManageable = ps.MinimumWidthManageable;
        p.MaximumWidthManageable = ps.MaximumWidthManageable;

        p.HeightAttributeId = ps.HeightAttributeId;
        p.MinimumHeightManageable = ps.MinimumHeightManageable;
        p.MaximumHeightManageable = ps.MaximumHeightManageable;

        p.DepthAttributeId = ps.DepthAttributeId;
        p.MinimumDepthManageable = ps.MinimumDepthManageable;
        p.MaximumDepthManageable = ps.MaximumDepthManageable;

        p.MinimumBillablePerimeter = ps.MinimumBillablePerimeter;
        p.MinimumBillableArea = ps.MinimumBillableArea;
        p.MinimumBillableVolume = ps.MinimumBillableVolume;

        _productRepository.Update(p);
      }
      else
        _productRepository.Insert(ps);
    }
        public ActionResult AdminProduct(Product_PriceForSize product)
        {
            _priceForSizeService.CreateOrUpdatePriceForSize(product);

            return(new ContentResult()
            {
                Content = "Save completed.", ContentType = "text/html"
            });
        }
 public Product_PriceForSize GetPriceForSize(int productId)
 {
   var retVal = (from p in _productRepository.Table
                 where p.ProductId == productId
                 select p).SingleOrDefault();
   if (retVal == null)
     retVal = new Product_PriceForSize()
     {
       ProductId = productId
     };
   return retVal;
 }
        public Product_PriceForSize GetPriceForSize(int productId)
        {
            var retVal = (from p in _productRepository.Table
                          where p.ProductId == productId
                          select p).SingleOrDefault();

            if (retVal == null)
            {
                retVal = new Product_PriceForSize()
                {
                    ProductId = productId
                }
            }
            ;
            return(retVal);
        }
    public ActionResult AdminProduct(Product_PriceForSize product)
    {
      _priceForSizeService.CreateOrUpdatePriceForSize(product);

      return new ContentResult() { Content = "Save completed.", ContentType = "text/html" };
    }