public ActionResult Index() { var mvcName = typeof(Controller).Assembly.GetName(); var isMono = Type.GetType("Mono.Runtime") != null; if (USER_NUMBER == -1) { return(RedirectToAction("NewUser")); } else { Day currentDayForUser = DayDAL.GetDayByUserAndDay(USER_NUMBER); User user = UserDAL.GetUser(USER_NUMBER); USER_NUMBER = user.intUserID; DAY_NUMBER = currentDayForUser.intDayID; HomeVM model = new HomeVM { user = user, intCalsLeft = currentDayForUser.intCalsLeft, intExMinsLeft = currentDayForUser.intExMinsLeft, mostRecentMeals = MealDAL.GetMealsByDayAndUser(currentDayForUser.intDayID, user.intUserID).Take(NUM_PREVIEWS).ToList(), mostRecentWorkouts = WorkoutRoutineDAL.GetWorkoutsByDayAndUser(currentDayForUser.intDayID, user.intUserID).Take(NUM_PREVIEWS).ToList() }; return(View(model)); } }
public ActionResult DeleteWorkout(WorkoutRoutine workout, int intDayID, int intUserID) { WorkoutHomeVM model = new WorkoutHomeVM() { LstWorkoutRoutines = WorkoutRoutineDAL.GetWorkoutsByDayAndUser(intDayID, intUserID).Where(w => w != workout) }; return(View("WorkoutHome", model)); }
public ActionResult WorkoutHome() { if (HomeController.USER_NUMBER == -1) { return(RedirectToAction("NewUser", "Home")); } else { User user = UserDAL.GetUser(HomeController.USER_NUMBER); Day day = DayDAL.GetDayByUserAndDay(user.intUserID); WorkoutHomeVM model = new WorkoutHomeVM() { user = user, LstWorkoutRoutines = WorkoutRoutineDAL.GetWorkoutsByDayAndUser(day.intDayID, user.intUserID) }; return(View(model)); } }