예제 #1
0
        public int AddDay(NewDayVm model)
        {
            var day = _mapper.Map <Day>(model);

            day.UserId = model.UserId;
            var meals = _mealRepo.GenerateDomainMealsForDay(model.Id);

            day.mealList = meals;
            _dayRepo.AddDay(day);
            return(day.Id);
        }
예제 #2
0
        public AppLogic(IDayRepository repo)
        {
            _repo = repo;

            if (!_repo.Days.Any(w => w.Date == DateTime.Today))
            {
                _repo.AddDay(
                    new Day()
                {
                    Date = DateTime.Today, PurchaseList = new List <Purchase>()
                }
                    );
                _repo.SaveData();
            }
        }