Beispiel #1
0
        public IHttpActionResult PostG1_N1_Class(G1_N1_Class g1_N1_Class)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.G1_N1_Class.Add(g1_N1_Class);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (G1_N1_ClassExists(g1_N1_Class.TeacherID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = g1_N1_Class.TeacherID }, g1_N1_Class));
        }
Beispiel #2
0
        public IHttpActionResult PutG1_N1_Class(int id, G1_N1_Class g1_N1_Class)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != g1_N1_Class.TeacherID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public IHttpActionResult GetG1_N1_Class(int id)
        {
            G1_N1_Class g1_N1_Class = db.G1_N1_Class.Find(id);

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

            return(Ok(g1_N1_Class));
        }
Beispiel #4
0
        public IHttpActionResult DeleteG1_N1_Class(int id)
        {
            G1_N1_Class g1_N1_Class = db.G1_N1_Class.Find(id);

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

            db.G1_N1_Class.Remove(g1_N1_Class);
            db.SaveChanges();

            return(Ok(g1_N1_Class));
        }