示例#1
0
        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));
        }
示例#2
0
 public void editFAQ(FAQ obj)
 {
     FAQRepository.Update(obj);
     SaveChange();
 }
示例#3
0
 public int UpdateFAQ(DLModel.FAQ faq)
 {
     return(_faqRepository.Update((DLModel.FAQ) new DLModel.FAQ().InjectFrom(faq)));
 }