public ActionResult Create(Softvision.BL.Entities.QuestionBL pQuestion) { try { var idSubCategory = Request.Form["drpSubCategory"]; var questionBody = Request.Form["editorTexarea"]; if (idSubCategory != null || questionBody != null) { pQuestion.CreatedDate = DateTime.Now; pQuestion.IdSubCategory = idSubCategory.ToInt(); pQuestion.InternalRep = questionBody; pQuestion.HTMLRep = TrueEditor.GenerateHTML(questionBody); if (BaseMVC.getUserId() != 0) { pQuestion.IdUser = BaseMVC.getUserId(); } KitBL.Instance.Questions.Insert(pQuestion); } return(RedirectToAction("Index", "Question")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Edit(int id, Softvision.BL.Entities.QuestionBL pQuestion) { try { // TODO: If user has access + XSS var editorTexareaText = Request.Form["editorTexarea"]; if (editorTexareaText != null || editorTexareaText != string.Empty) { var editorText = editorTexareaText.ToString(); pQuestion.InternalRep = editorText; pQuestion.HTMLRep = TrueEditor.GenerateHTML(editorText); pQuestion.CreatedDate = DateTime.Now; pQuestion.IdSubCategory = Request.Form["drpSubCategory"].ToInt(); if (BaseMVC.getUserId() != 0) { pQuestion.IdUser = BaseMVC.getUserId(); } KitBL.Instance.Questions.Update(pQuestion); } return(RedirectToAction("MyQuestions", "User")); } catch { return(RedirectToAction("Index", "Home")); } }