Beispiel #1
0
        public IHttpActionResult PutDM_Ban(int id, DM_Ban dM_Ban)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IHttpActionResult GetDM_Ban(int id)
        {
            DM_Ban dM_Ban = db.DM_Ban.Find(id);

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

            return(Ok(dM_Ban));
        }
Beispiel #3
0
        public IHttpActionResult PostDM_Ban(DM_Ban dM_Ban)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DM_Ban.Add(dM_Ban);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = dM_Ban.id }, dM_Ban));
        }
Beispiel #4
0
        public IHttpActionResult DeleteDM_Ban(int id)
        {
            DM_Ban dM_Ban = db.DM_Ban.Find(id);

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

            db.DM_Ban.Remove(dM_Ban);
            db.SaveChanges();

            return(Ok(dM_Ban));
        }