public IActionResult Checkout(long id, string customerName) { var bikeViewModel = new BikeViewModel { Bike = new Bike { id = id, CustomerName = customerName, DateModified = DateTime.Now, CheckOutTime = DateTime.Now, CheckInTime = null } }; if (id == 0) { bikeViewModel.Bike.id = _bikeService.GetLastId(); _bikeService.AddBike(bikeViewModel.Bike); } else { _bikeService.UpdateBike(bikeViewModel.Bike); } return(RedirectToAction("Index")); }
public void Execute(AddBikeCommandContext commandContext) { if (!_bikeNameVerifier.IsFree(commandContext.Name)) { throw new InvalidOperationException("Bike with same name already exists"); } commandContext.CreatedBike = _bikeService.AddBike(commandContext.Name, commandContext.HourCost, commandContext.Cost); _bikeService.MoveBike(commandContext.CreatedBike, commandContext.RentPoint); }
public void Execute(AddNewBikeCommandContext commandContext) { _bikeService.AddBike(commandContext.Name, commandContext.HourCost); }
public void AddBikeTest() { _bikeService.AddBike("1", 0.2m); }