Пример #1
0
        // PUT api/UserAppSetting/5
        public IHttpActionResult PutUserAppSetting(int id, UserAppSetting userappsetting)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userappsetting.UserAppSettingId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult GetUserAppSetting(int id)
        {
            UserAppSetting userappsetting = db.UserAppSettings.Find(id);

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

            return(Ok(userappsetting));
        }
Пример #3
0
        public IHttpActionResult PostUserAppSetting(UserAppSetting userappsetting)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.UserAppSettings.Add(userappsetting);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = userappsetting.UserAppSettingId }, userappsetting));
        }
Пример #4
0
        public IHttpActionResult DeleteUserAppSetting(int id)
        {
            UserAppSetting userappsetting = db.UserAppSettings.Find(id);

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

            db.UserAppSettings.Remove(userappsetting);
            db.SaveChanges();

            return(Ok(userappsetting));
        }