Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 5
0
        public async Task <IHttpActionResult> GetNCSystemManual(string id)
        {
            NCSystemManual nCSystemManual = await db.NCSystemManuals.FindAsync(id);

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

            return(Ok(nCSystemManual));
        }
Esempio n. 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));
        }