예제 #1
0
        public IHttpActionResult PostMA_PARTES(MA_PARTES mA_PARTES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_PARTES.Add(mA_PARTES);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_PARTESExists(mA_PARTES.C_CODIGO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_PARTES.C_CODIGO }, mA_PARTES));
        }
예제 #2
0
        public IHttpActionResult PutMA_PARTES(string id, MA_PARTES mA_PARTES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetMA_PARTES(string id)
        {
            MA_PARTES mA_PARTES = db.MA_PARTES.Find(id);

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

            return(Ok(mA_PARTES));
        }
예제 #4
0
        public IHttpActionResult DeleteMA_PARTES(string id)
        {
            MA_PARTES mA_PARTES = db.MA_PARTES.Find(id);

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

            db.MA_PARTES.Remove(mA_PARTES);
            db.SaveChanges();

            return(Ok(mA_PARTES));
        }