// GET: Diary public ActionResult DiaryOverview() { var currentUserID = (int)Session["UserId"]; var model = new DiaryModel(); model.trainingSessionList = DiaryRepository.getTrainingSessions(currentUserID); return View(model); }
public ActionResult DiaryOverview(DiaryModel model) { if (!ModelState.IsValid) { return View(model); } var currentUserID = (int)Session["UserId"]; if (model.dateFrom != null & model.dateTo != null) { DateTime dateFr = DateTime.Parse(model.dateFrom); DateTime dateT = DateTime.Parse(model.dateTo); model.trainingSessionList = DiaryRepository.getTrainingSessionsByDate(currentUserID, dateFr, dateT); } else { model.trainingSessionList = DiaryRepository.getTrainingSessions(currentUserID); } return View(model); }