Exemplo n.º 1
0
        public IHttpActionResult PutAppValueListData(int id, AppValueListData appValueListData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != appValueListData.AppValueListId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PostAppValueListData(AppValueListData appValueListData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AppValueListDatas.Add(appValueListData);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (AppValueListDataExists(appValueListData.AppValueListId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = appValueListData.AppValueListId }, appValueListData));
        }
Exemplo n.º 3
0
        public IHttpActionResult DeleteAppValueListData(int id)
        {
            AppValueListData appValueListData = db.AppValueListDatas.Find(id);

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

            db.AppValueListDatas.Remove(appValueListData);
            db.SaveChanges();

            return(Ok(appValueListData));
        }