Ejemplo n.º 1
0
        public IHttpActionResult PutExercisesAct(int id, ExercisesAct exercisesAct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != exercisesAct.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult ExerciseAddUpdate(int?guncelleID, string description, string descriptionURL, string exerciseName, int targetID, int imageID)
        {
            Xamarin_KURSATCAKALEntities DB = new Xamarin_KURSATCAKALEntities();

            try
            {
                ExercisesAct eklenecek = new ExercisesAct
                {
                    TargetRegionID = targetID,
                    Name           = exerciseName,
                    Description    = description,
                    DescriptionURL = descriptionURL,
                    ImageID        = imageID,
                };
                DB.ExercisesAct.Add(eklenecek);
                DB.SaveChanges();

                TempData["AdditionSuccess"] = "Ekleme İşlemi Başarılı";
            }
            catch (Exception)
            {
                TempData["ExerciseAddUpdateException"] = "Lütfen değeleri doğru formatta giriniz.";
            }
            return(RedirectToAction("ExerciseList"));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetExercisesAct(int id)
        {
            ExercisesAct exercisesAct = db.ExercisesAct.Find(id);

            if (exercisesAct == null)
            {
                return(NotFound());
            }

            return(Ok(exercisesAct));
        }
Ejemplo n.º 4
0
        public IHttpActionResult PostExercisesAct(ExercisesAct exercisesAct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ExercisesAct.Add(exercisesAct);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = exercisesAct.ID }, exercisesAct));
        }
Ejemplo n.º 5
0
        public IHttpActionResult DeleteExercisesAct(int id)
        {
            ExercisesAct exercisesAct = db.ExercisesAct.Find(id);

            if (exercisesAct == null)
            {
                return(NotFound());
            }

            db.ExercisesAct.Remove(exercisesAct);
            db.SaveChanges();

            return(Ok(exercisesAct));
        }
        public ActionResult ExerciseDelete(int exerciseID)
        {
            Xamarin_KURSATCAKALEntities DB = new Xamarin_KURSATCAKALEntities();

            try
            {
                ExercisesAct silinecek = DB.ExercisesAct.Where(x => x.ID == exerciseID).First();
                DB.ExercisesAct.Remove(silinecek);
                DB.SaveChanges();
                TempData["DeleteSuccess"] = "Silme İşlemi Başarılı";
            }
            catch (Exception)
            {
                TempData["ExerciseDeleteException"] = "Bu egzersiz kullanıcıların programlarında kullanılıyor.";
            }
            return(RedirectToAction("ExerciseList"));
        }