Ejemplo n.º 1
0
        public IHttpActionResult PutSubscribedTags(int id, SubscribedTags subscribedTags)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != subscribedTags.TagId)
            {
                return BadRequest();
            }

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
Ejemplo n.º 2
0
        public IHttpActionResult PostSubscribedTags(SubscribedTags subscribedTags)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.SubscribedTags.Add(subscribedTags);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = subscribedTags.TagId }, subscribedTags);
        }