public IActionResult UpdateMealPricing([FromBody] MealPricing mealPricing)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            bool result = _serviceEndPoint.UpdateMealPricing(mealPricing);

            return(Json(new { Result = result }));
        }
 public bool PostMealPricing(MealPricing mealPricing)
 {
     try
     {
         _simbaToursUnitOfWork._mealsPricingRepository.Insert(mealPricing);
         _simbaToursUnitOfWork.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Example #3
0
        private void IterateThroughMeals(IList <Item> mealItems, ref decimal runningCostItems, MealPricing unitPaymentMeal, TourClientViewModel tourClientModel, TourClient tourClient)
        {
            foreach (var it in tourClientModel.CombinedMeals.MealItems)
            {
                var actualItemCost = 0.00M;

                var itemType = (Domain.Models.ItemType)Enum.Parse <Domain.Models.ItemType>(it.ItemType.ToString());
                if (it.Quantity > 0)
                {
                    CalculateRunningItemCostMeal(itemType, tourClientModel, it, unitPaymentMeal, ref runningCostItems, ref actualItemCost);
                    mealItems.Add(new Item {
                        mealPricing = unitPaymentMeal, mealPricingId = unitPaymentMeal.MealPricingId, ItemCost = actualItemCost, ItemId = it.ItemId,
                        ItemType    = (Domain.Models.ItemType)Enum.Parse <Domain.Models.ItemType>(it.ItemType.ToString()),
                        Meal        = new Meal {
                            MealId = 0, TourClient = tourClient, TourClientId = tourClient.TourClientId
                        }, Quantity = it.Quantity
                    });
                }
            }
        }
Example #4
0
        private void CalculateRunningItemCostMeal(Domain.Models.ItemType itemType, TourClientViewModel tourClient, ItemViewModel it, MealPricing unitPaymentMeal, ref decimal runningCostOfItems, ref decimal actualItemCost)
        {
            switch (itemType)
            {
            case Domain.Models.ItemType.Meal:
                actualItemCost      = unitPaymentMeal.Price * it.Quantity;
                runningCostOfItems += actualItemCost;
                break;

            default:
                actualItemCost = 0.00M;
                break;
            }
        }