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")); }
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); }
public IActionResult EditDay(NewDayVm model) { _dayService.UpdateDay(model); return(RedirectToAction("Index")); }
public void UpdateDay(NewDayVm model) { var day = _mapper.Map <Day>(model); _dayRepo.UpdateDay(day); }