예제 #1
0
        public IHttpActionResult PutAppListData(int id, AppListData appListData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != appListData.AppListDataID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult GetAppListData(int id)
        {
            AppListData appListData = db.AppListDatas.Find(id);

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

            return(Ok(appListData));
        }
예제 #3
0
        public IHttpActionResult PostAppListData(AppListData appListData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AppListDatas.Add(appListData);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = appListData.AppListDataID }, appListData));
        }
예제 #4
0
        public IHttpActionResult SubList(int id)
        {
            AppListData appListData = db.AppListDatas.Find(id);

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

            appListData.FieldValue = "Abcd";

            return(Ok(appListData));
        }
예제 #5
0
        public IHttpActionResult DeleteAppListData(int id)
        {
            AppListData appListData = db.AppListDatas.Find(id);

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

            db.AppListDatas.Remove(appListData);
            db.SaveChanges();

            return(Ok(appListData));
        }