コード例 #1
0
        public IHttpActionResult PutMuscularStrengthAndEndurance(int id, MuscularStrengthAndEndurance muscularStrengthAndEndurance)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult PutTrunkLiftModel(int id, TrunkLiftModel trunkLiftModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public IHttpActionResult PutBodyComposition(int id, BodyComposition bodyComposition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
        public IHttpActionResult PutFlexibility(int id, Flexibility flexibility)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #5
0
        public IHttpActionResult PutCardiovascularFitness(int id, CardiovascularFitness cardiovascularFitness)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "ID,Owner,HalfMileTime,Pacer,MileTime,StepTestSteps,StepTestHeartRate,Logged")] CardiovascularFitness cardiovascularFitness)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cardiovascularFitness).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cardiovascularFitness));
 }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "ID,Owner,Height,Weight,BodyFat,Logged")] BodyComposition bodyComposition)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bodyComposition).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bodyComposition));
 }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "ID,Owner,SitAndReach,ArmAndShoulder,TrunkLift,Logged")] Flexibility flexibility)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flexibility).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flexibility));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "ID,Description")] Todo todo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(todo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(todo));
 }
 public ActionResult Edit([Bind(Include = "ID,Owner,CurlUps,RightAnglePushUps,MaxBench,MaxLegPress,PullUps,FlexedArmHang,Logged")] MuscularStrengthAndEndurance muscularStrengthAndEndurance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(muscularStrengthAndEndurance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(muscularStrengthAndEndurance));
 }
コード例 #11
0
 public ActionResult Edit([Bind("ID", "Description", "Owner")] Todo todo)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(todo).State = EntityState.Modified;
         _db.SaveChanges();
         return(new RedirectToActionResult("Index", "Todo", null));
     }
     return(View(todo));
 }
 public ActionResult Edit(Todo todo)
 {
     if (ModelState.IsValid)
     {
         // To simplify our sample, let's just update the 'Description' property by telling Entity Framework that just this property got modified.
         db.Todoes.Attach(todo);
         db.Entry(todo).Property(x => x.Description).IsModified = true;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(todo));
 }
 // Notification raised after ADAL accessed the cache.
 // If the HasStateChanged flag is set, ADAL changed the content of the cache
 void AfterAccessNotification(TokenCacheNotificationArgs args)
 {
     // if state changed
     if (this.HasStateChanged)
     {
         _cache = new PerWebUserCache
         {
             webUserUniqueId = _userId,
             cacheBits       = this.Serialize(),
             LastWrite       = DateTime.Now
         };
         //// update the db and the lastwrite
         _db.Entry(_cache).State = _cache.EntryId == 0 ? EntityState.Added : EntityState.Modified;
         _db.SaveChanges();
         this.HasStateChanged = false;
     }
 }