public ActionResult SaveAnserForLanguage(FAQModel model) { model.UserId = SessionHelper.UserId; var result = objFAQService.AddEditQuestionAnswerByLanguange(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public int Upate(FAQModel objFAQ) { int result = -1; try { SqlParameter prmFAQId = SqlHelper.CreateParameter("@FAQId", objFAQ.FAQId); SqlParameter prmQuestion = SqlHelper.CreateParameter("@Question", objFAQ.Question); SqlParameter prmAnswer = SqlHelper.CreateParameter("@Answer", objFAQ.Answer); // SqlParameter prmFaqCategoryId = SqlHelper.CreateParameter("@FaqCategoryId", objFAQ.FaqCategoryId); SqlParameter prmSort = SqlHelper.CreateParameter("@SortOrder", objFAQ.SortOrder); SqlParameter prmCreatedBy = SqlHelper.CreateParameter("@CreatedBy", AdminSessionData.AdminUserId); SqlParameter prmCreatedOn = SqlHelper.CreateParameter("@CreatedOn", DateTime.Now); SqlParameter prmCreatedFromIp = SqlHelper.CreateParameter("@CreatedFromIp", HttpContext.Current.Request.UserHostAddress); SqlParameter prmStatus = SqlHelper.CreateParameter("@Status", objFAQ.Status); SqlParameter prmFlag = SqlHelper.CreateParameter("@Flag", objFAQ.Flag); SqlParameter prmErr = SqlHelper.CreateParameter("@Err", -1, ParameterDirection.Output); SqlParameter[] allParams = { prmFAQId, prmQuestion, prmAnswer, prmSort, prmCreatedBy, prmCreatedOn, prmCreatedFromIp, prmStatus, prmFlag, prmErr }; SqlHelper.ExecuteNonQuery(_conString, CommandType.StoredProcedure, "Usp_AddUpdFAQ", allParams); if (prmErr.Value != null) { result = (int)prmErr.Value; } return(result); } catch { throw; } }
public ActionResult EditFaq(int id) { SqlConnection con = new SqlConnection(constring); String q = "SELECT * from FAQs where Qsn_no=@Qsn_no"; con.Open(); SqlCommand cmd = new SqlCommand(q, con); cmd.Parameters.AddWithValue("@Qsn_no", id); cmd.ExecuteNonQuery(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adapter.Fill(dt); FAQModel ob = new FAQModel(); if (dt.Rows.Count == 1) { ob.Qsn_no = Convert.ToInt32(dt.Rows[0][0].ToString()); ob.Question = dt.Rows[0][1].ToString(); ob.Answer = dt.Rows[0][2].ToString(); } return(View(ob)); }
public FAQModel GetByID(int Id) { try { var sqlCon = new SqlConnection(_conString); sqlCon.Open(); var sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "Usp_GetFAQ"; sqlCmd.Parameters.AddWithValue("@FAQId", Id); sqlCmd.Connection = sqlCon; FAQModel objFAQ = null; using (SqlDataReader reader = sqlCmd.ExecuteReader()) { while (reader.Read()) { objFAQ = new FAQModel(); objFAQ.FAQId = Convert.ToInt32(reader["FAQId"]); objFAQ.Question = reader["Question"].ToString(); objFAQ.Answer = reader["Answer"].ToString(); // objFAQ.FaqCategoryId = Convert.ToInt32(reader["FaqCategoryId"].ToString()); objFAQ.SortOrder = Convert.ToInt32(reader["SortOrder"].ToString()); objFAQ.Status = Convert.ToByte(reader["Status"]); } } sqlCon.Close(); return(objFAQ); } catch { throw; } }
public ActionOutput CreateFAQ(FAQModel faqModel) { var existingfaq = Context.FAQs.Where(z => z.Title.Trim().ToLower() == faqModel.Title.Trim().ToLower() && z.IsDeleted == false).FirstOrDefault(); if (existingfaq != null) { return(new ActionOutput { Status = ActionStatus.Error, Message = "This faq Name already exists and is also not marked as deleted." }); } else { var faq = Context.FAQs.Create(); faq.AddedOn = DateTime.UtcNow; faq.Description = faqModel.Description; faq.IsDeleted = false; faq.UpdatedOn = DateTime.UtcNow; faq.CategoryID = (int)faqModel.CategoryID; faq.Title = faqModel.Title; faq.Description = faqModel.Description; Context.FAQs.Add(faq); Context.SaveChanges(); return(new ActionOutput { Status = ActionStatus.Successfull, Message = "faq Details Added Successfully." }); } }
public ActionResult SaveFAQ(FAQModel model) { model.UserId = SessionHelper.UserId; var result = objFAQService.AddEditFAQ(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(FAQModel model) { var filename = "wwwroot/Documents/FAQ.md"; model.FAQtext = cls_markdown.ConvertMDtoTXT(filename); return(View(model)); }
public ActionResult OpenQuestionAnswerByLanguangePopUp(int QuestionId = 0) { BindLanguageList(); FAQModel objModel = new FAQModel(); objModel.QuestionId = QuestionId; return(View(ViewHelper.AddEditQuestionAnswerByLanguange, objModel)); }
private ActionResult BindFAQList() { FAQHelper _faqHelper = new FAQHelper(); FAQModel objFAQ = new FAQModel(); var FAQList = _faqHelper.GetAll().ToList(); ActiveFAQList = FAQList.Where(x => x.Status == 1).ToList(); InActiveFAQList = FAQList.Where(x => x.Status == 0).ToList(); return(View(Tuple.Create(ActiveFAQList, InActiveFAQList, objFAQ))); }
public async Task <IActionResult> New(FAQModel faqModel) { if (ModelState.IsValid) { var savedFAQ = await _faqService.SaveFAQ(faqModel); return(RedirectToAction(nameof(FAQController.List))); } return(View(faqModel)); }
public ActionResult AddEditFAQ(int?id) { var model = new FAQModel(); ViewBag.SelectedTab = SelectedAdminTab.FAQ; if (id > 0 && id != null) { model = _faqManager.GetFAQDetailsByID(Convert.ToInt32(id)); } return(View(model)); }
public ActionResult GetQuestionAnswerByLanguange(int LanguangeId = 0, int QuestionId = 0) { var result = objFAQService.GetQuestionAnswerByLanguange(LanguangeId, QuestionId); if (result == null) { FAQModel Model = new FAQModel(); result = Model; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Edit(FAQModel faqModel) { if (ModelState.IsValid) { await _faqService.UpdateFAQ(faqModel); var id = faqModel.Id; return(RedirectToAction(nameof(FAQController.List))); } return(View(faqModel)); }
public async Task UpdateFAQ(FAQModel faqModel) { try { FAQ faq = _mapper.Map <FAQ>(faqModel); await _faqManager.UpdateFAQ(faq); } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <FAQModel> > PostFAQModel(NewFAQRequestModel fAQRequestModel) { FAQModel fAQModel = new FAQModel() { Question = fAQRequestModel.Question, Solution = fAQRequestModel.Solution }; _context.fAQModels.Add(fAQModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFAQModel", new { id = fAQModel.ID }, fAQModel)); }
public async Task <FAQModel> GetFAQ(int?faqId) { try { FAQ faq = await _faqManager.GetFAQ(faqId); FAQModel faqModel = _mapper.Map <FAQModel>(faq); return(faqModel); } catch (Exception ex) { throw ex; } }
// FAQ Portion public ActionResult OpenFAQPopUp(int FAQId = 0) { BindQuestionList(); BindLanguageList(); FAQModel objModel = new FAQModel(); if (FAQId > 0) { FAQModel result = new FAQModel(); result = objFAQService.GetFAQByFAQId(FAQId); objModel = result; } return(View(ViewHelper.AddEditFAQ, objModel)); }
public JsonResult AddUpdatefaqDetails(FAQModel model) { ViewBag.SelectedTab = SelectedAdminTab.FAQ; var result = new ActionOutput(); if (model.ID > 0) { result = _faqManager.UpdateFAQDetails(model); } else { result = _faqManager.CreateFAQ(model); } return(JsonResult(result)); }
public async Task <FAQModel> SaveFAQ(FAQModel faqModel) { try { FAQ faq = _mapper.Map <FAQ>(faqModel); FAQ savedFAQ = await _faqManager.SaveFAQ(faq); FAQModel savedFAQModel = _mapper.Map <FAQModel>(savedFAQ); return(savedFAQModel); } catch (Exception ex) { throw ex; } }
public override bool InsertFAQ(FAQModel model) { using (SqlConnection cn = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("proc_ADD_FAQ", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = model.Id; cmd.Parameters.Add("@Id_User", SqlDbType.Int).Value = model.IdUser; cmd.Parameters.Add("@Descriotion", SqlDbType.NVarChar).Value = model.Descriotion; cmd.Parameters.Add("@Answer", SqlDbType.NVarChar).Value = model.Answer; cmd.Parameters.Add("@STATUS", SqlDbType.Int).Value = model.Status; cn.Open(); int re = ExecuteNonQuery(cmd); return(re == 1); } }
public FAQModel GetFAQByFAQId(int FAQId) { GenericRepository <FAQModel> objGenericRepository = new GenericRepository <FAQModel>(); FAQModel Result = new FAQModel(); try { Result = objGenericRepository.ExecuteSQL <FAQModel>("sp_GetFAQMasterByFAQId @FAQId", Utility.GetSQLParam("FAQId", SqlDbType.Int, FAQId) ).FirstOrDefault(); } catch (Exception ex) { } return(Result); }
public FAQModel GetQuestionAnswerByLanguange(int LanguangeId, int QuestionId) { GenericRepository <FAQModel> objGenericRepository = new GenericRepository <FAQModel>(); FAQModel Result = new FAQModel(); try { Result = objGenericRepository.ExecuteSQL <FAQModel>("sp_GetQuestionByLanguange @LanguangeId,@QuestionId", Utility.GetSQLParam("LanguangeId", SqlDbType.Int, LanguangeId), Utility.GetSQLParam("QuestionId", SqlDbType.Int, QuestionId) ).FirstOrDefault(); } catch (Exception ex) { } return(Result); }
public ActionResult CreateFaq(FAQModel ob, HttpPostedFileBase file) { SqlConnection con = new SqlConnection(constring); String q = "INSERT into FAQs(Question,Answer ) " + "values(@Question,@Answer )"; SqlCommand cmd = new SqlCommand(q, con); con.Open(); //cmd.Parameters.AddWithValue("@Qsn_no", ob.Qsn_no); cmd.Parameters.AddWithValue("@Question", ob.Question); cmd.Parameters.AddWithValue("@Answer", ob.Answer); cmd.ExecuteNonQuery(); return(RedirectToAction("Index")); }
public ActionResult Delete(int Id) { FAQModel model = new FAQModel(); FAQHelper faqHelper = new FAQHelper(); model.Flag = 3; model.FAQId = Id; int count = faqHelper.Delete(model); if (count == 0) { TempData["CommonMessage"] = AppLogic.setMessage(count, "Record deleted successfully."); } else { TempData["CommonMessage"] = AppLogic.setMessage(count, "Error, Please try again."); } return(RedirectToAction("Index")); }
public ActionResult EditFaq(FAQModel ob) { SqlConnection con = new SqlConnection(constring); String q = "Update FAQs set Question=@ Question,Answer=@Answer where Qsn_no=@Qsn_no"; con.Open(); SqlCommand cmd = new SqlCommand(q, con); cmd.Parameters.AddWithValue("@Qsn_no", ob.Qsn_no); cmd.Parameters.AddWithValue("@Question", ob.Question); cmd.Parameters.AddWithValue("@Answer", ob.Answer); cmd.ExecuteNonQuery(); return(RedirectToAction("FaqTable")); }
public ActionResult InActivate(int Id) { FAQModel objFAQ = new FAQModel(); FAQHelper faqHelper = new FAQHelper(); objFAQ.Flag = 2; objFAQ.FAQId = Id; objFAQ.Status = 0; int count = faqHelper.ActDeactFAQ(objFAQ); if (count == 0) { TempData["CommonMessage"] = AppLogic.setMessage(count, "Record Deactivated Successfully."); } else { TempData["CommonMessage"] = AppLogic.setMessage(count, "Error, Please try again."); } return(RedirectToAction("Index")); }
public string AddEditFAQ(FAQModel model) { GenericRepository <FAQModel> objGenericRepository = new GenericRepository <FAQModel>(); string Result = string.Empty; try { Result = objGenericRepository.ExecuteSQL <string>("sp_AddEditFAQMaster @FAQId,@QuestionId,@LanguageId,@Answer,@UserId", Utility.GetSQLParam("FAQId", SqlDbType.Int, model.FAQId), Utility.GetSQLParam("QuestionId", SqlDbType.Int, model.QuestionId), Utility.GetSQLParam("LanguageId", SqlDbType.Int, model.LanguageId), Utility.GetSQLParam("Answer", SqlDbType.VarChar, !string.IsNullOrWhiteSpace(model.Answer) ? model.Answer : (object)DBNull.Value), Utility.GetSQLParam("UserId", SqlDbType.Int, model.UserId) ).FirstOrDefault(); } catch (Exception ex) { Result = ex.Message.ToString(); } return(Result); }
public ActionResult Add(FAQModel objFAQ) { FAQHelper faqHelper = new FAQHelper(); int count = faqHelper.Add(objFAQ); if (count == 0) { TempData["CommonMessage"] = AppLogic.setMessage(count, "Record added successfully."); return(RedirectToAction("Index")); } else if (count == 1) { TempData["CommonMessage"] = AppLogic.setMessage(count, "Record already exists."); return(RedirectToAction("Add")); } else { TempData["CommonMessage"] = AppLogic.setMessage(count, "Error, Please try again."); return(RedirectToAction("Add")); } }
public ActionOutput UpdateFAQDetails(FAQModel faqModel) { var faq = Context.FAQs.FirstOrDefault(z => z.ID == faqModel.ID); if (faq == null) { return(new ActionOutput { Status = ActionStatus.Error, Message = "faq doesn't Exist." }); } var existingfaq = Context.FAQs.FirstOrDefault(z => z.ID != faqModel.ID && z.Title == faqModel.Title && z.IsDeleted != true); if (existingfaq != null) { return(new ActionOutput { Status = ActionStatus.Error, Message = "This faq Name already exists and is also not marked as deleted." }); } else { faq.Description = faqModel.Description; faq.Title = faqModel.Title; faq.CategoryID = (int)faqModel.CategoryID; faq.IsDeleted = faqModel.IsDeleted; faq.Description = faqModel.Description; faq.UpdatedOn = DateTime.UtcNow; Context.SaveChanges(); return(new ActionOutput { Status = ActionStatus.Successfull, Message = "faq Details Updated Successfully." }); } }
public async Task <Object> PutFAQModel(int id, FAQModel fAQModel) { UpdateResponse responseModel = new UpdateResponse() { IsSuccess = false, UpdatedObject = null }; if (id != fAQModel.ID) { return(BadRequest()); } _context.Entry(fAQModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); responseModel.IsSuccess = true; responseModel.UpdatedObject = fAQModel; } catch (DbUpdateConcurrencyException) { if (!FAQModelExists(id)) { return(NotFound()); } else { throw; } } return(responseModel); }
public abstract int InsertFAQ(FAQModel model);