public IHttpActionResult PutContactRecord(ContactRecord contactRecord)
        {
            string validationErrors = "";

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var currentContactRecord = db.ContactRecords.Find(contactRecord.ContactId);
                db.Entry(currentContactRecord).CurrentValues.SetValues(contactRecord);
                db.Entry(currentContactRecord).State = EntityState.Modified;
                db.SaveChanges();
            }

            catch (DbEntityValidationException e)
            {
                foreach (DbEntityValidationResult eve in e.EntityValidationErrors)
                {
                    foreach (DbValidationError ve in eve.ValidationErrors)
                    {
                        string error = ve.PropertyName + " - " + ve.ErrorMessage;
                        validationErrors += System.Environment.NewLine + error;
                    }
                }

                string x = validationErrors;
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
 public virtual void UpdateLead(LeadRecord leadRecord)
 {
     try
     {
         db.Entry(leadRecord).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        // PUT api/OrderDetail/5
        public IHttpActionResult PutOrderDetail(decimal id, OrderDetail orderdetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != orderdetail.OrderId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #4
0
        // PUT api/LeadRecord/5
        public IHttpActionResult PutLeadRecord(string id, LeadRecord leadrecord)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != leadrecord.LeadRecordId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "IDRServiceQueueId,ContactId,ClientCallId,ServiceQueue,Status,CreatedDate,ModifiedDate,ClientId")] IDRServiceQueue iDRServiceQueue)
 {
     if (ModelState.IsValid)
     {
         db.Entry(iDRServiceQueue).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ContactId = new SelectList(db.ContactRecords, "ContactId", "ClientCallId", iDRServiceQueue.ContactId);
     return(View(iDRServiceQueue));
 }
 public ActionResult Edit([Bind(Include = "ContactRecordDetailId,ContactId,QuestionId,QuestionText,QuestionResponseText,QuestionResponseValue,QuestionKeys")] ContactRecordDetail contactRecordDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contactRecordDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ContactId = new SelectList(db.ContactRecords, "ContactId", "ClientCallId", contactRecordDetail.ContactId);
     return(View(contactRecordDetail));
 }
Exemple #7
0
        public IHttpActionResult PutIDRServiceQueue(IDRServiceQueue queue)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.IDRServiceQueues.Attach(queue);
            db.Entry(queue).State = EntityState.Modified;
            db.SaveChanges();
            return(StatusCode(HttpStatusCode.NoContent));
        }