Beispiel #1
0
        public ActionResult EditQuestion(int id)
        {
            BePreferencesEntities db           = new BePreferencesEntities();
            InkeyAnswer           answerToEdit = db.InkeyAnswers.FirstOrDefault(i => i.InkeyAnswersId == id);

            //answerToEdit.ProductName = db.InkeyProducts.FirstOrDefault(p => p.InkeyProductsId == (int)answerToEdit.ProductId).ProductName;
            return(View(db.InkeyAnswers.FirstOrDefault(i => i.InkeyAnswersId == id)));
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
        public ActionResult InkeyAnswerForm(InkeyViewModel inkMod)
        {
            try
            {
                InkeyAnswer newAns = inkMod.answer;
                using (var db = new BePreferencesEntities())
                {
                    newAns.ProductName = db.InkeyProducts.FirstOrDefault(p => p.InkeyProductsId == inkMod.answer.ProductId).ProductName;
                    db.InkeyAnswers.Add(newAns);
                    db.SaveChanges();

                    return(View(new InkeyViewModel()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public InkeyViewModel()
 {
     answer           = new InkeyAnswer();
     InkeyAnswers     = db.InkeyAnswers.ToList();
     InkeyJsonAnswers = JsonConvert.SerializeObject(db.InkeyAnswers.ToArray());
 }
Beispiel #5
0
 public ActionResult SummerNote(InkeyAnswer inkAns)
 {
     return(View(inkAns));
 }
Beispiel #6
0
        public ActionResult SummerNote()
        {
            InkeyAnswer inkAns = new InkeyAnswer();

            return(View(inkAns));
        }