Beispiel #1
0
        public void AdjustPrice(AdjustPrice adjustPrice)
        {
            var adjustment = new PriceAdjustment(adjustPrice, Price);

            Adjustments.Add(adjustment);
            Price = adjustPrice.NewPrice;
        }
Beispiel #2
0
        internal void AdjustPrice(AdjustPrice adjustPrice)
        {
            var adjustment = new PriceAdjustment(adjustPrice, Price);

            Adjustments.Add(adjustment);
            Price = adjustment.NewPrice;
        }
        public ActionResult AdjustPriceUsingModification(string id, AdjustPrice adjustPrice)
        {
            var rental             = GetRental(id);
            var adjustment         = new PriceAdjustment(adjustPrice, rental.Price);
            var modificationupdate = Builders <Rental> .Update
                                     .Push(r => r.Adjustments, adjustment)
                                     .Set(r => r.Price, adjustPrice.NewPrice);

            Context.Rentals.UpdateOne(r => r.Id == id, modificationupdate);
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult AdjustPriceUsingModification(string id, AdjustPrice adjustPrice)
        {
            var rental             = GetRental(id);
            var adjustment         = new PriceAdjustment(adjustPrice, rental.Price);
            var modificationUpdate = Update <Rental>
                                     .Push(r => r.Adjustments, adjustment)
                                     .Set(r => r.Price, adjustPrice.NewPrice);

            Context.Rentals.Update(Query.EQ("_id", new ObjectId(id)), modificationUpdate);
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
 public void AdjustPrice(AdjustPrice adjustPrice)
 {
     var adjustment = new PriceAdjustment(adjustPrice, Price);
     Adjustments.Add(adjustment);
     Price = adjustPrice.NewPrice;
 }
Beispiel #6
0
 public async Task<ActionResult> AdjustPrice_RemoveThisBitToMakeMeActive(string id, AdjustPrice adjustPrice)
 {
     var rental = await GetRental(id);
     var adjustment = new PriceAdjustment(adjustPrice, rental.Price);
     var filter = Builders<Rental>.Filter.Eq(r => r.Id, id);
     var update = Builders<Rental>
         .Update
         .Push(r => r.Adjustments, adjustment)
         .Set(r => r.Price, adjustPrice.NewPrice);
     await Context.Rentals.UpdateOneAsync(filter, update);
     return RedirectToAction("Index");
 }