Exemplo n.º 1
0
 public AddWorkoutsPage(MainPageViewModel parent)
 {
     InitializeComponent();
     _parent        = parent;
     _viewModel     = new AddWorkoutViewModel(_parent);
     BindingContext = _viewModel;
 }
Exemplo n.º 2
0
        public AddWorkoutPage()
        {
            InitializeComponent();
            AddWorkoutViewModel wm = new AddWorkoutViewModel();

            wm.Navigation  = Navigation;
            BindingContext = wm;
        }
Exemplo n.º 3
0
        public ActionResult AddWorkout()
        {
            WorkoutMgr          workoutMgr   = new WorkoutMgr();
            GebruikerMgr        gebruikerMgr = new GebruikerMgr();
            AddWorkoutViewModel model        = new AddWorkoutViewModel();

            model.StandaardWorkouts        = workoutMgr.AlleStandaardWorkouts();
            model.WorkoutsHuidigeGebruiker = workoutMgr.AllPersonalWorkoutsOnGebruiker(1);

            return(View(model));
        }
Exemplo n.º 4
0
        public IActionResult Add(AddWorkoutViewModel addWorkoutViewModel)
        {
            if (ModelState.IsValid)
            {
                //Create user id connection to put into new exercise, linking ApplciationUser and Workout
                string          user         = User.Identity.Name;
                ApplicationUser userLoggedIn = context.Users.Single(c => c.UserName == user);

                Workout newWorkout = new Workout
                {
                    Name        = addWorkoutViewModel.Name,
                    DateCreated = DateTime.Now,
                    OwnerId     = userLoggedIn.Id
                };

                context.Workouts.Add(newWorkout);
                context.SaveChanges();

                return(Redirect("/Workout/ViewWorkout/" + newWorkout.WorkoutID));
            }

            return(View(addWorkoutViewModel));
        }
Exemplo n.º 5
0
 public AddWorkoutsPage()
 {
     InitializeComponent();
     _viewModel     = new AddWorkoutViewModel();
     BindingContext = _viewModel;
 }
Exemplo n.º 6
0
        //[Authorize]  This attribute will redirect to login page to allow access.
        public IActionResult Add()
        {
            AddWorkoutViewModel addMenuViewModel = new AddWorkoutViewModel();

            return(View(addMenuViewModel));
        }
Exemplo n.º 7
0
 public AddWorkout()
 {
     InitializeComponent();
     BindingContext = new AddWorkoutViewModel(Navigation);
 }