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)); }
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; } }
public Task <int> DeleteItemAsync(Excersize item) { return(database.DeleteAsync(item)); }
public Task <int> SaveItemAsync(Excersize item) { return(database.InsertOrReplaceAsync(item)); }
public ExcersizeLogWrapper(Excersize excersize) { ExcersizeTemplate = excersize; LoggedExcersizeTemp = new LoggedExcersize(); }
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); } }
public ExcersizeWrapper(Excersize _excersize) { Excersize = _excersize; }