Exemplo n.º 1
0
        public JsonResult Send(string name, string email, int phone_number, string msg_subject, string message)
        {
            var feedback = new questionandanswer();

            feedback.Name       = name;
            feedback.Email      = email;
            feedback.Phone      = phone_number;
            feedback.Subject    = msg_subject;
            feedback.Question   = message;
            feedback.CreateDate = DateTime.Now;
            var id = new FAQDao().InsertFeddBack(feedback);

            if (id > 0)
            {
                return(Json(new
                {
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
Exemplo n.º 2
0
        public bool Update(questionandanswer entity)
        {
            try
            {
                var faq = db.questionandanswer.Find(entity.ID);
                faq.Name     = entity.Name;
                faq.Phone    = entity.Phone;
                faq.Question = entity.Question;
                faq.Subject  = entity.Subject;
                faq.Answer   = entity.Answer;
                faq.status   = entity.status;

                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(questionandanswer model)
        {
            if (ModelState.IsValid)
            {
                var dao = new FAQDao();

                if (!string.IsNullOrEmpty(model.Question))
                {
                    var result = dao.Update(model);
                    if (result)
                    {
                        return(RedirectToAction("Index", "FAQ"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Cap nhap thanh cong");
                    }
                }
            }
            return(View());
        }
Exemplo n.º 4
0
 public long Insert(questionandanswer entity)
 {
     db.questionandanswer.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Exemplo n.º 5
0
 public long InsertFeddBack(questionandanswer fb)
 {
     db.questionandanswer.Add(fb);
     db.SaveChanges();
     return(fb.ID);
 }
Exemplo n.º 6
0
 public questionandanswer Add4([FromBody] questionandanswer question)
 {
     return(repository.Add4((int)question.ID, question));
 }
Exemplo n.º 7
0
 public bool Update4(int id, [FromBody] questionandanswer question)
 {
     return(repository.Update4(id, question));
 }