Esempio n. 1
0
        public IHttpActionResult PutCUSTOMER_COMPLAINTS(int id, CUSTOMER_COMPLAINTS cUSTOMER_COMPLAINTS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cUSTOMER_COMPLAINTS.COMPLAINT_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public IHttpActionResult GetCUSTOMER_COMPLAINTS(string id)
        {
            CUSTOMER_COMPLAINTS cUSTOMER_COMPLAINTS = db.CUSTOMER_COMPLAINTS.FirstOrDefault <CUSTOMER_COMPLAINTS>(x => x.CUSTOMER_ID == id);

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

            return(Ok(cUSTOMER_COMPLAINTS));
        }
Esempio n. 3
0
        public IHttpActionResult DeleteCUSTOMER_COMPLAINTS(int id)
        {
            CUSTOMER_COMPLAINTS cUSTOMER_COMPLAINTS = db.CUSTOMER_COMPLAINTS.Find(id);

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

            db.CUSTOMER_COMPLAINTS.Remove(cUSTOMER_COMPLAINTS);
            db.SaveChanges();

            return(Ok(cUSTOMER_COMPLAINTS));
        }
Esempio n. 4
0
        public IHttpActionResult PostCUSTOMER_COMPLAINTS(CUSTOMER_COMPLAINTS cUSTOMER_COMPLAINTS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CUSTOMER_COMPLAINTS.Add(cUSTOMER_COMPLAINTS);
            db.SaveChanges();

            var subscribed = Hub.Clients.Group(cUSTOMER_COMPLAINTS.CUSTOMER_ID);

            subscribed.addItem(cUSTOMER_COMPLAINTS);

            return(CreatedAtRoute("DefaultApi", new { id = cUSTOMER_COMPLAINTS.COMPLAINT_ID }, cUSTOMER_COMPLAINTS));
        }