Beispiel #1
0
        public static MealTypes Map(MealTypesViewModel mealTypes)
        {
            var result = new MealTypes();

            if (mealTypes == null)
            {
                return(result);
            }
            if (mealTypes.MealTypes != null && mealTypes.MealTypes.Any())
            {
                result.MealTypeDescriptions = mealTypes.MealTypes.Select(c => new MealTypeDescription {
                    Description = c.Description, MarketBasePrice = c.MarketBasePrice, Number = c.Number, OperationalCost = c.OperationalCost
                }).ToList();
            }
            else
            {
                result.MealTypeDescriptions.Add(new MealTypeDescription {
                    MarketBasePrice = 0, OperationalCost = 0, Number = (int)MealTypeEnum.OB
                });
            }
            result.UseInDynamicCalculation = mealTypes.UseInDynamicCalculation;
            result.PriceConstraints        = PriceConstraint.Map(mealTypes.PriceConstraints);
            result.Total = result.MealTypeDescriptions.Count();
            return(result);
        }
Beispiel #2
0
        public static MealTypesViewModel Map(MealTypes mealTypes)
        {
            var result = new MealTypesViewModel();

            if (mealTypes == null)
            {
                return(result);
            }
            result.UseInDynamicCalculation = mealTypes.UseInDynamicCalculation;
            if (mealTypes.MealTypeDescriptions != null && mealTypes.MealTypeDescriptions.Any())
            {
                result.MealTypes = mealTypes.MealTypeDescriptions.Select(c => new MealTypeViewModel {
                    Description = c.Description, MarketBasePrice = c.MarketBasePrice, Number = c.Number, OperationalCost = c.OperationalCost
                }).ToList();
            }

            result.PriceConstraints = PriceConstraint.Map(mealTypes.PriceConstraints);
            return(result);
        }
 public static ConfigurationRoot Map(ConfigurationViewModel config, IEnumerable <RoomType> roomTypes)
 {
     return(new ConfigurationRoot {
         Seasons = SeasonViewModel.Map(config.Seasons), Weekdays = WeekdaysViewModel.Map(config.Weekdays), RoomTypes = RoomTypesViewModel.Map(config.RoomTypes, roomTypes), MealTypes = MealTypesViewModel.Map(config.MealTypes), Categories = CategoriesViewModel.Map(config.Categories)
     });
 }