public TimeSpan MakeOrder(DishDTO dishDTO, ICookerService cookerSv, ICookService cookSv, IDishService dishSv) { if (dishDTO == null) { throw new NullReferenceException(); } DateTime orderTime = DateTime.Now; Dish dish = dishSv.Find(dishDTO.Id); Cooker cooker = cookerSv.FindCooker(dish); Cook cook = cookSv.FindCook(); TimeSpan cookerTimeToCook = cookerSv.TimeToCook(dish, cooker, orderTime); TimeSpan cookTimeToCook = cookSv.TimeToCook(dish, cook, orderTime); TimeSpan maxCookingTime = cookerTimeToCook >= cookTimeToCook ? cookerTimeToCook : cookTimeToCook; DateTime finishTime = orderTime.Add(maxCookingTime); cookerSv.Update(cooker, finishTime); cookSv.Update(cook, finishTime); AddOrder(orderTime, finishTime, dish, cook, cooker); _db.Save(); return(maxCookingTime); }
public CartController(IRecipeService recipeService, IRestaurantService restaurantService, ICookService cookService, IPaymentService paymentService, IOrderService orderService) { _recipeService = recipeService; _restaurantService = restaurantService; _cookService = cookService; _paymentService = paymentService; _orderService = orderService; }
public ApplicationViewModel(ICookerService cookerService, ICookService cookService, IDishService dishService, IOrderService orderService) { _dishService = dishService; _cookerService = cookerService; _cookService = cookService; _orderService = orderService; OrderDishCommand = new Command(OrderDish); Dishes = _dishService.GetDishes(); }
public RestaurantController(IRestaurantService restaurantService, ICookService cookService) { this._restaurantService = restaurantService; this._cookService = cookService; }