public ActionResult BBCodes() { var bbCodes = _bbCodeRepository.Get(); BBCodeViewModel model = new BBCodeViewModel() { BBCodes = bbCodes }; return(View(model)); }
public ActionResult EditBBCode(int BBCodeID) { BBCode bbCode = _bbCodeRepository.Get(BBCodeID); BBCodeViewModel model = new BBCodeViewModel() { Tag = bbCode.Tag, Parse = bbCode.Parse, BBCodeID = bbCode.BBCodeID }; return(View(model)); }
public ActionResult EditBBCode(BBCodeViewModel model) { if (IsModelValidAndPersistErrors()) { BBCode bbCode = _bbCodeRepository.Get(model.BBCodeID); TryUpdateModel(bbCode); _bbCodeRepository.Update(bbCode); SetSuccess("BB Code edited"); return(RedirectToAction("BBCodes")); } return(RedirectToSelf(new { BBCodeID = model.BBCodeID })); }
public ActionResult BBCodes(BBCodeViewModel model) { if (IsModelValidAndPersistErrors()) { BBCode bbCode = new BBCode() { Parse = model.Parse, Tag = model.Tag }; _bbCodeRepository.Add(bbCode); SetSuccess("BB Code created"); } return(RedirectToSelf()); }