public async Task <IHttpActionResult> PutInkeyUserQuestion(int id, InkeyUserQuestion inkeyUserQuestion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != inkeyUserQuestion.InkeyUserQuestionsId)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InkeyUserQuestionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public ActionResult EditProduct(InkeyProduct inkProduct)
        {
            try
            {
                using (var db = new BePreferencesEntities())
                {
                    db.Entry(inkProduct).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }

                return(RedirectToAction("ProductManager"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        private void ReInstateMemberToDatabase(BEMemberList member)
        {
            try
            {
                using (var db = new BePreferencesEntities())
                {
                    member.Archived = false;

                    db.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
Example #4
0
        public ActionResult EditQuestion(InkeyAnswer inkAnswer)
        {
            try
            {
                using (var db = new BePreferencesEntities())
                {
                    inkAnswer.ProductName     = db.InkeyProducts.FirstOrDefault(p => p.InkeyProductsId == inkAnswer.ProductId).ProductName;
                    db.Entry(inkAnswer).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }

                return(RedirectToAction("InkeyAnswerForm"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
        private void RemoveMemberToDatabase(BEMemberList member, string newListId)
        {
            try
            {
                using (var db = new BePreferencesEntities())
                {
                    member.ListId = newListId;
                    member.Archived = true;

                    db.Entry(member).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                }
            }
            catch (Exception)
            {

                throw;
            }
        }