Exemplo n.º 1
0
        public void UpdateDiscountRange(ServiceDataContracts.DiscountRange discountRange)
        {
            var drToUpdate = db.DiscountRanges.FirstOrDefault(dr => dr.Id == discountRange.Id);

            drToUpdate.DiscountPercent = discountRange.DiscountPercent;
            drToUpdate.End             = discountRange.End;
            drToUpdate.Start           = discountRange.Start;

            db.SaveChanges();
        }
Exemplo n.º 2
0
        public ServiceDataContracts.DiscountRange GetDiscountRange(long discountRangeId)
        {
            var dr     = db.DiscountRanges.FirstOrDefault(ac => ac.Id == discountRangeId);
            var result = new ServiceDataContracts.DiscountRange();

            result.DiscountPercent = dr.DiscountPercent;
            result.End             = dr.End;
            result.Id    = dr.Id;
            result.Start = dr.Start;

            return(result);
        }
Exemplo n.º 3
0
        public long CreateDiscountRange(ServiceDataContracts.DiscountRange discountRange)
        {
            var dr = new Entities.DiscountRange();

            dr.DiscountPercent = discountRange.DiscountPercent;
            dr.End             = discountRange.End;
            dr.Start           = discountRange.Start;

            db.DiscountRanges.Add(dr);
            db.SaveChanges();

            return(dr.Id);
        }