示例#1
0
        public IHttpActionResult PostMA_CXP(MA_CXP mA_CXP)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_CXP.Add(mA_CXP);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_CXPExists(mA_CXP.C_Documento))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_CXP.C_Documento }, mA_CXP));
        }
示例#2
0
        public IHttpActionResult PutMA_CXP(string id, MA_CXP mA_CXP)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public IHttpActionResult GetMA_CXP(string id)
        {
            MA_CXP mA_CXP = db.MA_CXP.Find(id);

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

            return(Ok(mA_CXP));
        }
示例#4
0
        public IHttpActionResult DeleteMA_CXP(string id)
        {
            MA_CXP mA_CXP = db.MA_CXP.Find(id);

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

            db.MA_CXP.Remove(mA_CXP);
            db.SaveChanges();

            return(Ok(mA_CXP));
        }