コード例 #1
0
        public IHttpActionResult PutRegistroMercadeo(int id, RegistroMercadeo registroMercadeo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != registroMercadeo.RegistroMercadeoID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetRegistroMercadeo(int id)
        {
            RegistroMercadeo registroMercadeo = db.RegistrosMercadeo.Find(id);

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

            return(Ok(registroMercadeo));
        }
コード例 #3
0
        public IHttpActionResult PostRegistroMercadeo(RegistroMercadeo registroMercadeo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RegistrosMercadeo.Add(registroMercadeo);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = registroMercadeo.RegistroMercadeoID }, registroMercadeo));
        }
コード例 #4
0
        public IHttpActionResult DeleteRegistroMercadeo(int id)
        {
            RegistroMercadeo registroMercadeo = db.RegistrosMercadeo.Find(id);

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

            db.RegistrosMercadeo.Remove(registroMercadeo);
            db.SaveChanges();

            return(Ok(registroMercadeo));
        }