예제 #1
0
        public ActionResult AddExcercise(TrainingExcercise model)
        {
            var userId = User.Identity.GetUserId();

            try
            {
                TrainingExcercise excercise = new TrainingExcercise()
                {
                    TrainingElementId = model.TrainingElementId,
                    ExcerciseName     = model.ExcerciseName,
                    SeriesNumber      = model.SeriesNumber,
                    Repetition        = model.Repetition,
                    TrainingTime      = model.TrainingTime,
                    Weight            = model.Weight,
                    UserId            = userId
                };
                db.Excercises.Add(excercise);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Incorrect data";
            }

            return(RedirectToAction("AddExcercise", "Log"));
        }
예제 #2
0
        // GET: Log
        public ActionResult AddExcercise()
        {
            TrainingExcercise excercise = new TrainingExcercise();

            excercise.ExcerciseNames = Excercises();
            return(View(excercise));
        }