Пример #1
0
        public IHttpActionResult PutExerciseType(int id, ExerciseType exerciseType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != exerciseType.ExerciseTypeID)
            {
                return(BadRequest());
            }

            db.Entry(exerciseType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExerciseTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ExerciseTypeID,Description")] ExerciseType exerciseType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exerciseType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(exerciseType));
 }
Пример #3
0
 public ActionResult Edit([Bind(Include = "ExerciseSessionID,StartTime,EndTime,ExerciseTypeID")] ExerciseSession exerciseSession)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exerciseSession).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ExerciseTypeID = new SelectList(db.ExerciseTypes, "ExerciseTypeID", "Description", exerciseSession.ExerciseTypeID);
     return(View(exerciseSession));
 }