public ActionResult DeleteConfirmed(int id)
        {
            Excersize excersize = db.Excersizes.Find(id);

            db.Excersizes.Remove(excersize);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,videoFileHandler")] Excersize excersize)
 {
     if (ModelState.IsValid)
     {
         db.Entry(excersize).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(excersize));
 }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Excersize excersize = db.Excersizes.Find(id);

            if (excersize == null)
            {
                return(HttpNotFound());
            }
            return(View(excersize));
        }
        public ActionResult Create([Bind(Include = "ID,Name,videoFileHandler")] Excersize excersize)
        {
            if (ModelState.IsValid)
            {
                if (excersize.videoFileHandler != null)
                {
                    string vid     = System.IO.Path.GetFileName(excersize.videoFileHandler.FileName);
                    string pathVid = System.IO.Path.Combine(
                        Server.MapPath("~/Upload"), vid);
                    excersize.videoFileHandler.SaveAs(pathVid);
                    excersize.Video = "../Upload/" + vid;
                }

                db.Excersizes.Add(excersize);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(excersize));
        }
Exemple #5
0
        private async Task CreateNewExcersize()
        {
            string newExcersize    = "New Excersize";
            string chooseExcersize = "Select Excersize";

            var x = await Application.Current.MainPage.DisplayActionSheet("Add Excersize", "cancel", null, newExcersize, chooseExcersize);

            if (x == newExcersize)
            {
                Excersize excersize = await _navigationService.Navigate <NewExcersizeViewModel, bool, Excersize>(true);

                if (Excersizes == null)
                {
                    Excersizes = new MvxObservableCollection <ExcersizeLogWrapper>();
                }
                Excersizes.Add(new ExcersizeLogWrapper(excersize));
                await RaisePropertyChanged("Excersizes");
            }
            else if (x == chooseExcersize)
            {
                return;
            }
        }
Exemple #6
0
 public Task <int> DeleteItemAsync(Excersize item)
 {
     return(database.DeleteAsync(item));
 }
Exemple #7
0
 public Task <int> SaveItemAsync(Excersize item)
 {
     return(database.InsertOrReplaceAsync(item));
 }
Exemple #8
0
 public ExcersizeLogWrapper(Excersize excersize)
 {
     ExcersizeTemplate   = excersize;
     LoggedExcersizeTemp = new LoggedExcersize();
 }
Exemple #9
0
        public async Task FirstInit()
        {
            List <Excersize> x = await App.ExcersizeDatabase.GetItemsAsync();

            List <WorkoutTemplate> y = await App.WorkoutTemplateDatabase.GetItemsAsync();

            if (x.Count == 0 && y.Count == 0)
            {
                WorkoutTemplate pushTemplate = new WorkoutTemplate();
                pushTemplate.ID   = "pushTemplateID";
                pushTemplate.Name = "Push";
                await App.WorkoutTemplateDatabase.SaveItemAsync(pushTemplate);

                WorkoutTemplate pullTemplate = new WorkoutTemplate();
                pullTemplate.ID   = "pullTemplateID";
                pullTemplate.Name = "Pull";
                await App.WorkoutTemplateDatabase.SaveItemAsync(pullTemplate);

                WorkoutTemplate legsTemplate = new WorkoutTemplate();
                legsTemplate.ID   = "legsTemplateID";
                legsTemplate.Name = "Legs";
                await App.WorkoutTemplateDatabase.SaveItemAsync(legsTemplate);

                Excersize bpress = new Excersize();
                bpress.ID         = Guid.NewGuid().ToString();
                bpress.Name       = "Bench Press";
                bpress.Machine    = "Bench";
                bpress.Sets       = "3";
                bpress.RepRange   = "8-12";
                bpress.TemplateID = new List <string>();
                bpress.TemplateID.Add(pushTemplate.ID);
                await App.ExcersizeDatabase.SaveItemAsync(bpress);

                Excersize shoulderpress = new Excersize();
                shoulderpress.ID         = Guid.NewGuid().ToString();
                shoulderpress.Name       = "Shoulder press";
                shoulderpress.Machine    = "Squat Rack";
                shoulderpress.Sets       = "3";
                shoulderpress.RepRange   = "8-12";
                shoulderpress.TemplateID = new List <string>();
                shoulderpress.TemplateID.Add(pushTemplate.ID);
                await App.ExcersizeDatabase.SaveItemAsync(shoulderpress);

                Excersize squat = new Excersize();
                squat.ID         = Guid.NewGuid().ToString();
                squat.Name       = "Squat";
                squat.Machine    = "Squat Rack";
                squat.Sets       = "3";
                squat.RepRange   = "8-12";
                squat.TemplateID = new List <string>();
                squat.TemplateID.Add(legsTemplate.ID);
                await App.ExcersizeDatabase.SaveItemAsync(squat);

                Excersize deadLift = new Excersize();
                deadLift.ID         = Guid.NewGuid().ToString();
                deadLift.Name       = "Deadlift";
                deadLift.Machine    = "Straight Bar";
                deadLift.Sets       = "5";
                deadLift.RepRange   = "3-5";
                deadLift.TemplateID = new List <string>();
                deadLift.TemplateID.Add(pullTemplate.ID);
                await App.ExcersizeDatabase.SaveItemAsync(deadLift);
            }
        }
Exemple #10
0
 public ExcersizeWrapper(Excersize _excersize)
 {
     Excersize = _excersize;
 }