Esempio n. 1
0
        public IActionResult AddDay(NewDayVm model)
        {
            model.UserId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var id = _dayService.AddDay(model);

            //string id2 = User.FindFirstValue(ClaimTypes.NameIdentifier);
            //_mealService.AddMealsToDay(id);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public IActionResult EditDay(NewDayVm model)
 {
     _dayService.UpdateDay(model);
     return(RedirectToAction("Index"));
 }
Esempio n. 4
0
        public void UpdateDay(NewDayVm model)
        {
            var day = _mapper.Map <Day>(model);

            _dayRepo.UpdateDay(day);
        }