public IActionResult AddGoalLog(LogAddGoalLogViewModel data) { if (GoalLogViewModelToInterface(data) != null) { if (_goalLogLogic.Add(AuthController.GetAuthUserId(User), GoalLogViewModelToInterface(data))) { return(RedirectToAction("Index")); } } return(RedirectToAction("Index")); }
public void GoalLog_Add_GoalShouldBeAdded_ValidationSucceeded() { var user = new UserDto { Id = 1, }; var goallog = new GoalLogDto { Calories = 2500, DateTime = DateTime.Now, User = user, }; var expected = true; var actual = _goallogLogic.Add(user.Id, goallog); Assert.AreEqual(expected, actual); }