Exemplo n.º 1
0
        public bool UpdateDiscount(DiscountDataContract discountDC)
        {
            Discount discountEF = new Discount();

            discountEF = context.DiscountSet.FirstOrDefault(x => x.Id == discountDC.Id);
            discountEF.PriceInclVAT = discountDC.PriceInclVAT;
            discountEF.Percent      = discountDC.Percent;
            discountEF.DiscountFrom = discountDC.DiscountFrom;
            discountEF.DiscountTo   = discountDC.DiscountTo;
            //priceEF.UnitOfMeasure = itemDC.UnitOfMeasure;

            //itemEF.Price1 = itemDC.Price1;
            try
            {
                //context.ShopSet.Add(shopEF);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(true);
        }
Exemplo n.º 2
0
        public List <DiscountDataContract> GetDiscountByPrice(int priceId)
        {
            List <DiscountDataContract> discountsDC = new List <DiscountDataContract>();

            List <Discount> discountsEF = context.DiscountSet.Where(x => x.PriceId == priceId).ToList();

            foreach (var item in discountsEF)
            {
                DiscountDataContract discountDataContract = new DiscountDataContract();
                discountDataContract.DiscountFrom = item.DiscountFrom;
                discountDataContract.DiscountTo   = item.DiscountTo;
                discountDataContract.Id           = item.Id;
                discountDataContract.Percent      = item.Percent;
                //discountDataContract.Price = item.Price;
                discountDataContract.PriceId      = item.PriceId;
                discountDataContract.PriceInclVAT = item.PriceInclVAT;

                discountsDC.Add(discountDataContract);
            }


            return(discountsDC);
        }
Exemplo n.º 3
0
        public bool SetDiscount(DiscountDataContract discountDC)
        {
            Discount discountEF = new Discount();

            discountEF.PriceInclVAT = discountDC.PriceInclVAT;
            discountEF.Percent      = discountDC.Percent;
            discountEF.DiscountFrom = discountDC.DiscountFrom;
            discountEF.DiscountTo   = discountDC.DiscountTo;

            //itemEF.Price1 = itemDC.Price1;

            try
            {
                context.DiscountSet.Add(discountEF);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(true);
        }