Esempio n. 1
0
        private IGoalLog GoalLogViewModelToInterface(LogAddGoalLogViewModel viewModel)
        {
            var goalLog = new GoalLog
            {
                DateTime = DateTime.Now,
                User     = AuthController.GetAuthUser(User),
                Calories = viewModel.Calories
            };

            return(goalLog);
        }
Esempio n. 2
0
 public IActionResult AddGoalLog(LogAddGoalLogViewModel data)
 {
     if (GoalLogViewModelToInterface(data) != null)
     {
         if (_goalLogLogic.Add(AuthController.GetAuthUserId(User), GoalLogViewModelToInterface(data)))
         {
             return(RedirectToAction("Index"));
         }
     }
     return(RedirectToAction("Index"));
 }