Пример #1
0
        public ActionResult BBCodes()
        {
            var             bbCodes = _bbCodeRepository.Get();
            BBCodeViewModel model   = new BBCodeViewModel()
            {
                BBCodes = bbCodes
            };

            return(View(model));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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 }));
        }
Пример #4
0
        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());
        }