Esempio n. 1
0
        // PUT api/AppSetting/5
        public IHttpActionResult PutAppSetting(int id, AppSetting appsetting)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != appsetting.AppSettingId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT api/ExternalSystem/5
        public IHttpActionResult PutExternalSystem(int id, ExternalSystem externalsystem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != externalsystem.ExternalSystemId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT api/MwoAMatchMetric/5
        public IHttpActionResult PutMwoAMatchMetric(int id, MwoAMatchMetric mwoamatchmetric)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mwoamatchmetric.MwoAMatchMetricId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT api/VariantAssocMetric/5
        public IHttpActionResult PutvwVariantAssocMetric(int id, vwVariantAssocMetric vwvariantassocmetric)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vwvariantassocmetric.vwVariantAssocMetricId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 5
0
        // PUT api/UserPref/5
        public IHttpActionResult PutUserPref(int id, UserPref userpref)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userpref.UserPrefId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 6
0
        // PUT api/DropDeck12/5
        public IHttpActionResult PutDropDeck12(int id, DropDeck12 dropdeck12)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dropdeck12.DropDeck12Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 7
0
        private bool ConfirmAccount(string confirmationToken)
        {
            MwaDBContext context = new MwaDBContext();
            MechWarrior  user    = context.Users.SingleOrDefault(u => u.ConfirmationToken == confirmationToken);

            if (user != null)
            {
                user.IsConfirmed = true;
                DbSet <MechWarrior> dbSet = context.Set <MechWarrior>();
                dbSet.Attach(user);
                context.Entry(user).State = EntityState.Modified;
                context.SaveChanges();

                return(true);
            }
            return(false);
        }