public IActionResult AddWeightlog(LogAddWeightLogViewModel data) { if (_weightLogLogic.Add(AuthController.GetAuthUserId(User), WeightLogViewModelToInterface(data))) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
private IWeightlog WeightLogViewModelToInterface(LogAddWeightLogViewModel viewmodel) { var weightLog = new WeightLog { DateTime = DateTime.Now, User = AuthController.GetAuthUser(User), Weight = viewmodel.Weight }; return(weightLog); }