示例#1
0
        public IHttpActionResult PostMA_SUCURSALES(MA_SUCURSALES mA_SUCURSALES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MA_SUCURSALES.Add(mA_SUCURSALES);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (MA_SUCURSALESExists(mA_SUCURSALES.C_codigo))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = mA_SUCURSALES.C_codigo }, mA_SUCURSALES));
        }
示例#2
0
        public IHttpActionResult PutMA_SUCURSALES(string id, MA_SUCURSALES mA_SUCURSALES)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public IHttpActionResult GetMA_SUCURSALES(string id)
        {
            MA_SUCURSALES mA_SUCURSALES = db.MA_SUCURSALES.Find(id);

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

            return(Ok(mA_SUCURSALES));
        }
示例#4
0
        public IHttpActionResult DeleteMA_SUCURSALES(string id)
        {
            MA_SUCURSALES mA_SUCURSALES = db.MA_SUCURSALES.Find(id);

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

            db.MA_SUCURSALES.Remove(mA_SUCURSALES);
            db.SaveChanges();

            return(Ok(mA_SUCURSALES));
        }