Пример #1
0
        public async Task <IHttpActionResult> Posticd_chapters(icd_chapters icd_chapters)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.icd_chapters.Add(icd_chapters);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (icd_chaptersExists(icd_chapters.col1))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = icd_chapters.col1 }, icd_chapters));
        }
Пример #2
0
        public async Task <IHttpActionResult> Puticd_chapters(string id, icd_chapters icd_chapters)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != icd_chapters.col1)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public async Task <IHttpActionResult> Geticd_chapters(string id)
        {
            icd_chapters icd_chapters = await db.icd_chapters.FindAsync(id);

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

            return(Ok(icd_chapters));
        }
Пример #4
0
        public async Task <IHttpActionResult> Deleteicd_chapters(string id)
        {
            icd_chapters icd_chapters = await db.icd_chapters.FindAsync(id);

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

            db.icd_chapters.Remove(icd_chapters);
            await db.SaveChangesAsync();

            return(Ok(icd_chapters));
        }