コード例 #1
0
        public IHttpActionResult PutRisk_Period(int id, Risk_Period risk_Period)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetRisk_Period(int id)
        {
            Risk_Period risk_Period = db.Risk_Period.Find(id);

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

            return(Ok(risk_Period));
        }
コード例 #3
0
        public IHttpActionResult GetRisk_Period(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Risk_Period risk_Period = db.Risk_Period.Find(id);

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

            return(Ok(risk_Period));
        }
コード例 #4
0
        public IHttpActionResult PostRisk_Period(Risk_Period risk_Period)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Risk_Period.Add(risk_Period);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = risk_Period.RiskP_ID }, risk_Period));
        }
コード例 #5
0
        public IHttpActionResult DeleteRisk_Period(int id)
        {
            Risk_Period risk_Period = db.Risk_Period.Find(id);

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

            db.Risk_Period.Remove(risk_Period);
            db.SaveChanges();

            return(Ok(risk_Period));
        }
コード例 #6
0
        public IHttpActionResult DeleteRisk_Period(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Risk_Period risk_Period = db.Risk_Period.Find(id);

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

            db.Risk_Period.Remove(risk_Period);
            db.SaveChanges();

            return(Ok(risk_Period));
        }