public async Task <CommonMealShoppingInfoViewModel> Map(CommonMealShoppingInfo item)
        {
            var meal = await _commonMealRepository.GetById(item.MealId);

            return(new CommonMealShoppingInfoViewModel
            {
                MealId = item.MealId,
                Date = meal.Date,
                DateName = _timeFormatter.GetDateName(meal.Date),
                DayName = _timeFormatter.GetDayName(meal.Date).ToUpperFirstLetter(),
                Adults = _personGroupMapper.Map(item.Adults),
                Children = _personGroupMapper.Map(item.Children),
                Budget = item.Budget,
                Expenses = await _commonMealExpenseMapper.MapMany(item.Expenses)
            });
        }
Ejemplo n.º 2
0
        public override CommonMealViewModel Map(CommonMeal item)
        {
            var registrations = _commonMealRegistrationMapper.MapMany(item.Registrations);

            var result = new CommonMealViewModel
            {
                Id                 = item.Id,
                Date               = item.Date,
                DateName           = _timeFormatter.GetDateName(item.Date),
                DayName            = _timeFormatter.GetDayName(item.Date).ToUpperFirstLetter(),
                Note               = item.Note,
                IsActiveMeal       = _timeProvider.Now().Date == item.Date.Date,
                Status             = item.Status,
                RegistrationGroups = _registrationGroupFactory.CreateGroups(registrations),
                Chefs              = _commonMealChefMapper.MapMany(item.Chefs)
            };

            CalcRegistrationNumber(result);

            return(result);
        }