예제 #1
0
        public IHttpActionResult PutIncident_Status(int id, Incident_Status incident_Status)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public IHttpActionResult GetIncident_Status(int id)
        {
            Incident_Status incident_Status = db.Incident_Status.Find(id);

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

            return(Ok(incident_Status));
        }
예제 #3
0
        public IHttpActionResult PostIncident_Status(Incident_Status incident_Status)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Incident_Status.Add(incident_Status);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = incident_Status.Incident_Status_ID }, incident_Status));
        }
예제 #4
0
        public IHttpActionResult DeleteIncident_Status(int id)
        {
            Incident_Status incident_Status = db.Incident_Status.Find(id);

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

            db.Incident_Status.Remove(incident_Status);
            db.SaveChanges();

            return(Ok(incident_Status));
        }