public IHttpActionResult PostAfdelingTable(AfdelingTable afdelingTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AfdelingTables.Add(afdelingTable);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (AfdelingTableExists(afdelingTable.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = afdelingTable.Id }, afdelingTable));
        }
        public IHttpActionResult PutAfdelingTable(string id, AfdelingTable afdelingTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != afdelingTable.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetAfdelingTable(string id)
        {
            AfdelingTable afdelingTable = db.AfdelingTables.Find(id);

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

            return(Ok(afdelingTable));
        }
        public IHttpActionResult DeleteAfdelingTable(string id)
        {
            AfdelingTable afdelingTable = db.AfdelingTables.Find(id);

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

            db.AfdelingTables.Remove(afdelingTable);
            db.SaveChanges();

            return(Ok(afdelingTable));
        }