Exemplo n.º 1
0
        public async Task <IHttpActionResult> PutCAT_COLOR(short id, CAT_COLOR cAT_COLOR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> GetCAT_COLOR(short id)
        {
            CAT_COLOR cAT_COLOR = await db.CAT_COLOR.FindAsync(id);

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

            return(Ok(cAT_COLOR));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> PostCAT_COLOR(CAT_COLOR cAT_COLOR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CAT_COLOR.Add(cAT_COLOR);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = cAT_COLOR.id }, cAT_COLOR));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> DeleteCAT_COLOR(short id)
        {
            CAT_COLOR cAT_COLOR = await db.CAT_COLOR.FindAsync(id);

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

            db.CAT_COLOR.Remove(cAT_COLOR);
            await db.SaveChangesAsync();

            return(Ok(cAT_COLOR));
        }