Пример #1
0
        public IHttpActionResult PutApplTable(int id, ApplTable applTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != applTable.AppId)
            {
                return(BadRequest());
            }

            applDb.Entry(applTable).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult GetApplTable(int id)
        {
            ApplTable applTable = applDb.ApplTables.Find(id);

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

            return(Ok(applTable));
        }
Пример #3
0
        public IHttpActionResult PostApplTable(ApplTable applTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            applDb.ApplTables.Add(applTable);
            applDb.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = applTable.AppId }, applTable));
        }
Пример #4
0
        public IHttpActionResult DeleteApplTable(int id)
        {
            ApplTable applTable = applDb.ApplTables.Find(id);

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

            applDb.ApplTables.Remove(applTable);
            applDb.SaveChanges();

            return(Ok(applTable));
        }