public ActionResult AdjustPrice(string id, AdjustPrice adjustPrice) { var rental = GetRental(id); rental.AdjustPrice(adjustPrice); Context.Rentals.Save(rental); return RedirectToAction("Index"); }
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; }
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"); }
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"); }
public void AdjustPrice(AdjustPrice adjustPrice) { Adjustments.Add(new PriceAdjustment(adjustPrice, Price)); Price = adjustPrice.NewPrice; }
public PriceAdjustment(AdjustPrice adjustPrice, decimal oldPrice) { OldPrice = oldPrice; NewPrice = adjustPrice.newPrice; Reason = adjustPrice.Reasong; }