public void deleteFAQ(int id) { FAQ FAQ = FAQRepository.GetById(id); FAQRepository.Delete(FAQ); SaveChange(); }
public ActionResult Edit(FAQViewModel model, string toDo = "") { if (toDo.ToLower() == "delete") { _faqRepository.Delete(model.Id); _faqRepository.Save(); return(RedirectToAction("Index")); } if (ModelState.IsValid) { var faq = _faqRepository.Find(model.Id); model.UserId = User.Identity.GetUserId(); faq.Update(model); _faqRepository.Update(faq); _faqRepository.Save(); return(RedirectToAction("Index")); } AddToViewBag(); return(View("Edit", model)); }
public Message Delete(int FAQId) { var message = new Message(); try { int result = _iFAQRepository.Delete(FAQId); if (result > 0) { message = Message.SetMessages.SetSuccessMessage("FAQ Deleted Successfully."); } else { message = Message.SetMessages.SetErrorMessage("Failed to Delete Data."); } } catch (Exception ex) { message = Message.SetMessages.SetErrorMessage(ex.Message); } return(message); }
public void DeleteFAQ(int faqCatID) { _faqRepository.Delete(_faqRepository.GetById(faqCatID)); }