示例#1
0
        public async Task <IHttpActionResult> Putschipklasse(int id, schipklasses schipklasse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != schipklasse.KLASSEID)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!schipklasseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <IHttpActionResult> Getschipklasse(int id)
        {
            schipklasses schipklasse = await db.schipklasse.FindAsync(id);

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

            return(Ok(schipklasse));
        }
示例#3
0
        public async Task <IHttpActionResult> Postschipklasse(schipklasses schipklasse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.schipklasse.Add(schipklasse);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = schipklasse.KLASSEID }, schipklasse));
        }
示例#4
0
        public async Task <IHttpActionResult> Deleteschipklasse(int id)
        {
            schipklasses schipklasse = await db.schipklasse.FindAsync(id);

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

            db.schipklasse.Remove(schipklasse);
            await db.SaveChangesAsync();

            return(Ok(schipklasse));
        }