Beispiel #1
0
        public IHttpActionResult PostMA_PROVEEDORES(MA_PROVEEDORES mA_PROVEEDORES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_PROVEEDORES.Add(mA_PROVEEDORES);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_PROVEEDORESExists(mA_PROVEEDORES.c_codproveed))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_PROVEEDORES.c_codproveed }, mA_PROVEEDORES));
        }
Beispiel #2
0
        public IHttpActionResult PutMA_PROVEEDORES(string id, MA_PROVEEDORES mA_PROVEEDORES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public IHttpActionResult GetMA_PROVEEDORES(string id)
        {
            MA_PROVEEDORES mA_PROVEEDORES = db.MA_PROVEEDORES.Find(id);

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

            return(Ok(mA_PROVEEDORES));
        }
Beispiel #4
0
        public IHttpActionResult DeleteMA_PROVEEDORES(string id)
        {
            MA_PROVEEDORES mA_PROVEEDORES = db.MA_PROVEEDORES.Find(id);

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

            db.MA_PROVEEDORES.Remove(mA_PROVEEDORES);
            db.SaveChanges();

            return(Ok(mA_PROVEEDORES));
        }