Exemplo n.º 1
0
        public IHttpActionResult PutIN_Receiver(int id, IN_Receiver iN_Receiver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != iN_Receiver.ReceiverID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetIN_Receiver(int id)
        {
            IN_Receiver iN_Receiver = db.IN_Receiver.Find(id);

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

            return(Ok(iN_Receiver));
        }
Exemplo n.º 3
0
        public IHttpActionResult PostIN_Receiver(IN_Receiver iN_Receiver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.IN_Receiver.Add(iN_Receiver);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = iN_Receiver.ReceiverID }, iN_Receiver));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteIN_Receiver(int id)
        {
            IN_Receiver iN_Receiver = db.IN_Receiver.Find(id);

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

            db.IN_Receiver.Remove(iN_Receiver);
            db.SaveChanges();

            return(Ok(iN_Receiver));
        }