Example #1
0
        public IHttpActionResult PutIncident_Type(int id, Incident_Type incident_Type)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult GetIncident_Type(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Incident_Type incident_Type = db.Incident_Type.Find(id);

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

            return(Ok(incident_Type));
        }
Example #3
0
        public IHttpActionResult PostIncident_Type(Incident_Type incident_Type)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Incident_Type.Add(incident_Type);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = incident_Type.Incident_Type_ID }, incident_Type));
        }
Example #4
0
        public IHttpActionResult DeleteIncident_Type(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Incident_Type incident_Type = db.Incident_Type.Find(id);

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

            db.Incident_Type.Remove(incident_Type);
            db.SaveChanges();

            return(Ok(incident_Type));
        }