Exemplo n.º 1
0
        public IHttpActionResult PostMA_IMPRESORAS(MA_IMPRESORAS mA_IMPRESORAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_IMPRESORAS.Add(mA_IMPRESORAS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_IMPRESORASExists(mA_IMPRESORAS.cs_NUMERO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_IMPRESORAS.cs_NUMERO }, mA_IMPRESORAS));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutMA_IMPRESORAS(string id, MA_IMPRESORAS mA_IMPRESORAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetMA_IMPRESORAS(string id)
        {
            MA_IMPRESORAS mA_IMPRESORAS = db.MA_IMPRESORAS.Find(id);

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

            return(Ok(mA_IMPRESORAS));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteMA_IMPRESORAS(string id)
        {
            MA_IMPRESORAS mA_IMPRESORAS = db.MA_IMPRESORAS.Find(id);

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

            db.MA_IMPRESORAS.Remove(mA_IMPRESORAS);
            db.SaveChanges();

            return(Ok(mA_IMPRESORAS));
        }