コード例 #1
0
        public async Task <IHttpActionResult> PostNCSystemManual(NCSystemManual nCSystemManual)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NCSystemManuals.Add(nCSystemManual);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (NCSystemManualExists(nCSystemManual.TypeID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = nCSystemManual.TypeID }, nCSystemManual));
        }
コード例 #2
0
        public async Task <IHttpActionResult> PutNCSystemManual(string id, NCSystemManual nCSystemManual)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NCSystemManualExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public async Task<IHttpActionResult> PostNCSystemManual(NCSystemManual nCSystemManual)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.NCSystemManuals.Add(nCSystemManual);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (NCSystemManualExists(nCSystemManual.TypeID))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = nCSystemManual.TypeID }, nCSystemManual);
        }
コード例 #4
0
        public async Task<IHttpActionResult> PutNCSystemManual(string id, NCSystemManual nCSystemManual)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NCSystemManualExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #5
0
        public async Task <IHttpActionResult> GetNCSystemManual(string id)
        {
            NCSystemManual nCSystemManual = await db.NCSystemManuals.FindAsync(id);

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

            return(Ok(nCSystemManual));
        }
コード例 #6
0
        public async Task <IHttpActionResult> DeleteNCSystemManual(string id)
        {
            NCSystemManual nCSystemManual = await db.NCSystemManuals.FindAsync(id);

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

            db.NCSystemManuals.Remove(nCSystemManual);
            await db.SaveChangesAsync();

            return(Ok(nCSystemManual));
        }