コード例 #1
0
 public DishModel Add(DishModel dishModel)
 {
     var dish = Mapper.Map<Dish>(dishModel);
     dish.Category = _categoryManager.GetById(dishModel.CategoryId);
     dish.Ingredients = _ingredientManager.Get()
         .Where(x => dishModel.IngredientIds.Contains(x.Id))
         .ToList();
     _dishManager.Add(dish);
     return Mapper.Map<DishModel>(dish);
 }
コード例 #2
0
 public void ChangeDishStatus(DishModel dish, int receiptId, string status)
 {
     var receipt = _receiptManager
         .Get(receiptId);
     var order = receipt.ClientOrders
         .FirstOrDefault(x => x.Dish.Name == dish.Name);
     var prevStatus = order.Status.ToString();
     order.Status = (OrderStatus) Enum.Parse(typeof(OrderStatus), status);
     _orderManager.Update(order);
     Clients.User(receipt.Client.Login).onChangeDishStatus(dish, status, prevStatus);
 }