Ejemplo n.º 1
0
        public ActionResult Reply(Answer par)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.msgError = fn.fg.DataIsntValid;
            }
            else
            {
                if (Session["Id"] == null)
                {
                    par.ID_USER_ADMIN = 9;//Code for Guest
                    par.CREATED_BY    = "Guest";
                }
                else
                {
                    par.ID_USER_ADMIN = int.Parse(Session["Id"].ToString());
                    par.CREATED_BY    = Session["UserName"].ToString();
                }

                var isSave = repo.Add(par);
                if (isSave == true)
                {
                    TempData["msgS"] = fn.fg.Save;
                }
                else
                {
                    TempData["msgE"] = fn.fg.SFailed;
                }
            }
            return(RedirectToAction("DetailQA/" + par.ID_QUESTIONS.ToString(), "Home"));
        }
Ejemplo n.º 2
0
 public IActionResult Create(Answer model)
 {
     if (ModelState.IsValid)
     {
         _Answer.Add(model);
         return(RedirectToAction("Index", "Question"));
     }
     return(View(model));
 }