public ActionResult AdjustPrice(string id, AdjustPrice adjustPrice)
 {
     var rental = GetRental(id);
     rental.AdjustPrice(adjustPrice);
     Context.Rentals.Save(rental);
     return RedirectToAction("Index");
 }
Exemple #2
0
 public void AdjustPrice(AdjustPrice adjustPrice)
 {
     var adjustment = new PriceAdjustment(adjustPrice, Price);
     Adjustments.Add(adjustment);
     Price = adjustPrice.NewPrice;
 }
 public PriceAdjustment(AdjustPrice adjustPrice, decimal oldPrice)
 {
     OldPrice = oldPrice;
     NewPrice = adjustPrice.NewPrice;
     Reason = adjustPrice.Reason;
 }
Exemple #4
0
 public async Task<ActionResult> AdjustPrice(string id, AdjustPrice adjustPrice)
 {
     var rental = await GetRental(id);
     rental.AdjustPrice(adjustPrice);
     var filter = new BsonDocument("_id", new ObjectId(id));
     await Context.Rentals.ReplaceOneAsync(filter, rental);
     return RedirectToAction("Index");
 }
Exemple #5
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");
 }
Exemple #6
0
 public void AdjustPrice(AdjustPrice adjustPrice)
 {
     Adjustments.Add(new PriceAdjustment(adjustPrice, Price));
     Price = adjustPrice.NewPrice;
 }
Exemple #7
0
 public PriceAdjustment(AdjustPrice adjustPrice, decimal oldPrice)
 {
     OldPrice = oldPrice;
     NewPrice = adjustPrice.newPrice;
     Reason   = adjustPrice.Reasong;
 }